Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ITypeInfo::Invoke

22 views
Skip to first unread message

Eric S. Fisher

unread,
Jul 21, 1999, 3:00:00 AM7/21/99
to
I am writing an application that needs to do late-binding to a COM library.
Unfortunately this library supports only a vtable interface, no IDispatch
interface. I see through the documentation that it seems possible to use
the ITypeInfo::Invoke call to invoke a member through the vtable interface.
It seems that we need to call ITypeInfo::CreateInstance to get an instance
handle to pass to ITypeInfo::Invoke.

Is there any good documentation or sample code that would be helpful in
implementing this functionality?


Borislav Iordanov

unread,
Jul 26, 1999, 3:00:00 AM7/26/99
to

First, to use ITypeInfo for objects not supporting IDispatch, you need a
COM type library (TLB). A TLB is either a stand alone file (.tlb) or it
is stored in the server itself as a ressource. In any case, the steps
are:

1) Create a ITypeLib interface (via the 'LoadTypeLib' API function).
2) Call ITypeLib::GetTypeInfo to obtain ITypeInfo interface.
3) Call ITypeInfo::Invoke

Check also the ITypeComp interface obtained (from ITypeInfo) which might
prove useful to you.

You don't have to create the object through ITypeInfo::CreateInstance.
You can also use the standard CoCreateInstance API function since
ITypeInfo::CreateInstance has a parameter for the actual object pointer
anyway.

The call to ITypeInfo::Invoke is very similar to IDispatch::Invoke. The
only difficulty is constructing the function arguments themselves.
Lookup 'IDispatch::Invoke' in MSDN Help - it is a lot better documented
(examples and all) then ITypeInfo::Invoke.

All those interfaces and functions are very nice, but I have a big
problem with them: the arguments accepted by 'Invoke' are restricted
only to OLE automation types (that which can be stored in a VARIANT). No
structures, no C arrays etc. I'm still looking for a way to pass
parameters of those types as well. If someone has a clue, please pass it
by (and thanks!).

Borislav

0 new messages