tags:

views:

167

answers:

2

I am looking for "typical" way one navigates MSDN to get a COM class to do what they want.

Example problem: I am looking for an API way to unblock a local file (remove internet zone/mark of the web from a file programmatically).

I found one post on stackoverflow.com that talked about clsid_persistentzoneidentifier. so i searched in MSDN and got to http://msdn.microsoft.com/en-us/library/ms537029(VS.85).aspx. What I am looking for,is what one does after they get to this url. From this location, I am not able to figure what the sequence of operations should be. How do I connect this IZoneIdentifier to IPersistFile? etc. There must be something basic that I am missing wrt COM related documentation. MSDN has interfaces and objects, but nothing that helps me visualize a "sequence" diagram of sorts. Nothing that will get me to understand which COM objects are from same class. hence can/or should be QueryInterfaced, adn which should be CoCreated.

Thanks! -Durga

+1  A: 

For that purpose, if it's not obvious from the documentation, I like to find sample programs in which relevent APIs are used: either using Google, or perhaps from whichever of the Microsoft SDKs is relevent.

Microsoft SDKs, for example this one, include sample programs.

ChrisW
+3  A: 

The documentation for that indicates a few things.

The first is that you can call CoCreateInstance, passing CLSID_PersistentZoneIdentifier to get an implementation of these two interfaces:

  • IPersistFile
  • IZoneIdentifier

It also says:

Use IPersistFile to attach the object to the target file and IZoneIdentifier to examine or to manipulate the zone ID.

That being said, you can look at the documentation for IPersistFile here:

http://msdn.microsoft.com/en-us/library/ms687223(VS.85).aspx

It shows that there is a Load method, which is what you want to call with the filename to load the implementation with details about the file.

From there, you can call QueryInterface on the IPersistFile implementation to get the IZoneIdentifier interface and then call the Remove method on it to set the zone to the local machine.

casperOne