Pointer to COM object

Pointer to COM object

Post by Emmanuel F » Thu, 24 Aug 2006 18:41:30


While seeking to understand the Active Accessibility API, I have
discovered that I need to transform an address pointer (to a IDispatch
Interface) into a truly operable COM object, as in tcom or optcl. Such
pointers are returned by functions like ActiveObjectFromWindow(), and,
unless I can create a COM object from there, I am stucked.

In a (desperate) attempt to make this work, I have been looking into
what the C code declaration for the COM interfaces are. Basically, the
pointer returned points to a pointer to a virtual function table that
forms the interface. Functions, in this table, typically takes the
pointer (the COM object!) as their first argument. Using a bit of
reverse engineering on the header files of the windows API (the w32api
from cygwin for example), and a package like ffidl, I think that calling
the necessary functions is possible. But it feels like a whole of a hack
and far from fail-proof, which is why I would largely rely on a COM package.

Any ideas?