Re: Typelib issue
"George" <George@discussions.microsoft.com> wrote in message
news:069E37B9-5D33-4FC8-8286-57797CE7E65D@microsoft.com
STDMETHODIMP MyObject::Invoke(DISPID dispid, DISPPARAMS* params,
...) { // XXX
}
Sorry for my bad English. My initiative in your implementation is,
1. using "this" or something which identifies the current instance of
object, the purpose is to get its base address, which is the same as
the vtable of the coclass;
2. then using the 1st parameter dispid to access the vtable by index,
say the ith function is dispid * 4 on 32-bit system, then I could get
the function pointer address;
DISPIDs are not necessarily assigned to methods sequentially, and in
general they cannot be. For example, get_Property and put_Property are
two different methods in the vtable, but they have the same DISPID.
3. Finally through the function pointer address retrieved in step 2,
we pass parameter as the 2nd input parameter params to do the real
invoke.
Could you elaborate on "pass parameter" part? IDispatch::Invoke receives
an array of VARIANTs (leaving aside things like named arguments). It's
unlikely that your actual methods take an array of VARIANTs. Show how
you plan to call a method with a correct set of arguments.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925