none
List methods of a COM object from VB Script RRS feed

  • Question

  • I have a COM DLL created in C++. I need to list the interface functions within the DLL. Can anyone share the VB script code to do the same?
    Tuesday, August 13, 2019 12:29 PM

All replies

  • Hello,

    This forum is for VB.NET, not VBScript so I'm moving your question to the VB Script forum.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Tuesday, August 13, 2019 1:07 PM
  • I do not understand why you need to list the functions using VBA. My guess is that you just need to see what the functions are so you can use them in VBA. By definition of COM, the COM DLL should not change the functions it exposes so there is no need to list the functions to call the functions dynamically.


    Sam Hobbs
    SimpleSamples.Info

    Tuesday, August 13, 2019 11:05 PM
  • I see this is a repost of How to check for a method in COM DLL.


    Sam Hobbs
    SimpleSamples.Info

    Tuesday, August 13, 2019 11:52 PM
  • Hi Simple Samples,

    Actually I need to do this checking to identify between two versions of a COM DLL(Not in a position to check the DLL version). It is little unorthodox way but we plan to do this way for our requirement. I posted this in both forums to check whether I get a solution either in VB Script or C++

    Wednesday, August 14, 2019 4:37 AM
  • This is a VBA forum not VBScript. 
    Wednesday, August 14, 2019 1:36 PM
  • Interfaces and their methods are implemented by COM objects (coclass).  COM rules specify that interfaces are immutable.  This means that once the interface has been designed and published its methods are known and cannot be changed.  So you should know which COM objects implement the interface and method of interest.  That should enable you to search the registry for the CLSID registration (assuming reg-free com is not being used) to determine the related DLL by examining the InprocServer32 registry key.

    An embedded type library (or separate .tlb/.olb) is a convenient source of information, but is not an absolute requirement and may not be available.

    But keep in mind that more than one COM object can implement an interface.

    So if COM object A in DLL A implements ISomeInterface and COM object B in DLL B also implements ISomeInterface how would you distinguish between them?


    • Edited by RLWA32 Wednesday, August 14, 2019 2:56 PM
    Wednesday, August 14, 2019 2:50 PM
  • For what it is worth, previously I said:

    By definition of COM, the COM DLL should not change the functions it exposes

    And that is a shorter version of:

    Interfaces and their methods are implemented by COM objects (coclass).  COM rules specify that interfaces are immutable.  This means that once the interface has been designed and published its methods are known and cannot be changed.



    Sam Hobbs
    SimpleSamples.Info

    Wednesday, August 14, 2019 6:24 PM
  • If you can find tlbinf32.dll (it used to be distributed with VB6) you can use it with VBA to list the entire public interface exposed by a com dll / ocx / olb / tlb / exe, its procedure definitions, named constants, etc. However even with the tlbinf32 it's a lot of work, 147,000 lines in my version
    Thursday, August 15, 2019 7:50 AM
    Moderator