Search code examples
comoletypelib

List all objects of an OLE automation server


If I know the name of an OLE automation server (as found under HKEY_CLASSES_ROOT), is there any way to query all available objects, their methods and properties even if the server does not support early binding and thus cannot be found in the object browser?

If yes, could you please provide a few lines of code (prefer VB but really doesn't matter) how to do this?


Solution

  • You can if the server has a Type Library (.TLB file) associated. Otherwise, there is no way.

    You can find the TLB id (it's also a guid) reference if it exists as the default value of the registry key TypeLib, here:

    HKCR\CLSID\<your CLSID>\TypeLib
    

    And then, the TypeLib id points to

    HKCR\TypeLib\<tlb id>
    

    In which you can find the TLB path in the keys underneath (depending on the architecture, it can be difference on x86 or x64).

    For example, here is the path to the standard ADO's 2.6 (ActiveX Data Objects) type library:

    enter image description here

    Once you have a TLB, you can use COM's API to browse it. That's ok from C++ or native clients, but for automation clients such as VB, VBScript, etc, there was this DLL "tlbinf32.dll" that allowed you to do it. Here is a link that talks about it: Accessing Type Libraries from VB