Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


COM: Get the REFIID from CLSID?

This topic is 6016 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

How can someone having the CLSID of the class in a COM object can expose the interfaces available? The only way I can see is to use QueryInterface in a loop until he/she "bumps" into an interface that is supported (quite ugly). Any better ways?

Share this post

Link to post
Share on other sites
Try using CoCreateInstance and the IDispatch interface along with the CLSID. Here's a snippet of how to do it in C

IDispatch *pIDispatch;
HRESULT hr = CoCreateInstance(&clsid, 0
, &IID_IDispatch, (void**)&pIDispatch);

ITypeInfo *pTypeInfo;
hr = IDispatch_GetTypeInfo(pIDispatch, 0, 0, &pTypeInfo);
// pIDispatch->lpVtbl->GetTypeInfo

BSTR interfaceName;
hr = ITypeInfo_GetDocumentation(pTypeInfo, -1, &interfaceName, 0, 0, 0);
// pTypeInfo->lpVtbl->GetDocumentation

From there you can use GetTypeAttr, GetFuncDesc, and GetDocumentation to retrieve method names.

For how to do it in C++ see


Edited by - lessbread on February 1, 2002 2:33:38 AM

Share this post

Link to post
Share on other sites
Ok jesterlecodeur, suppose you make this interface that exposes all the REFIIDs of the interfaces supported by the COM dll. How would you then get the REFIID of this interface having only the CLSID?

Another way is to make a function that would do exactly that: return the REFIID of such an interface. Then with a "LoadLibrary" and a "GetProcAddress" you could get this function and then the interface and from there... talking about ugly ways! Let alone that I think it''s breaking the COM model of programming. I''ll better check the stuff lessbread sent me

Share this post

Link to post
Share on other sites
I''m curious myself as to whether the methods detailed in that article will produce useable interfaces - they might only give strings. If you don''t have adequate help info look for "automat.chm" and "automat.chi" in ftp://ftp.microsoft.com/developr/PlatformSDK/feb2001/common/help/
and "com.chi" and "com.chm" might also be helpful.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!