I want to programaticly retrieve the Interface ID for any class so that I can pass it to CoCreateInstance. Any help is very much appreciated!!
See \"How Do I Get
You already know it. It's going to be the compile-time output type that you want the function to store in the pInterface
variable that you've given it.
In other words, what interface type are you going to treat that object you've created as? Which interface's methods are you going to call on it?
The type you get from CLSIDFromProgID
might be any version of the interface, including one that didn't even exist at the time you compiled your code. You can usually assume that whatever version is available at run time also supports some lesser version that you know about at compile time. You ask the OS to instantiate an instance of the recent version, but then you also ask it to return a reference to the lesser version's interface — the one you know how to handle.
The function calls QueryInterface
on the object for you, using the type you requested, something like this:
obj->QueryInterface(riid, pInterface);
If you have nothing more specific to request, just use IUnknown
.