tags:

views:

41

answers:

1

Hello

Can we call COM exposed interface METHODS at runtime one by one. This can be achieved in case of WIN32 DLL's using reflections. But SAME job need to be done with COM Dll or COM EXE, We'll be able to view all exposed methods of that COM DLL or COM EXE and ony by one we need to call all of them.(Remember I need to call unmanaged code, purely written in VC++ unmanaged code) . That would NOT be .NET assembly.

Regards Usman

+1  A: 

Hi.

If the target COM object supports the IDispatch interface you could read its typelibrary and call the methods dynamically. But you still need to figure out what to pass should the method take any arguments.

Vagaus
and what if COM Object suuports IUnknown interface...? As my most of COM binaries support only IUnknown interface?
Usman
Well, I don't see why you could not read the component's typelib, instantiate each CoClass, QueryInterface for each implemented interface and iterate over its methods (through vtable) calling one by one. Of course, this approach assumes the components does have a typelib and it will require a some **fun** code.
Vagaus