I would like to use the tlbinf32.dll to read type info for a COM object. At the moment I have access to the pointer to the ITypeLib interface. I can use VTable offsets and DispCallFunc to manually call methods and navgate, however I was hoping to use the powerful builtin capabilities of that library.
I was thinking that since TLI.ClassInfoFromObject(Object As IUnknown)
can be used to query the IDispatch::GetTypeInfo method, I could manually construct a dummy object that implements just this method to allow the TypeInfo to be read into memory. Similar to manually defining IEnumVariant
where most of the methods just return E_NOTIMPL = &H80004001
. Does this sound feasible? Is there a simpler way to access the TypeInfo from a pointer using VBA?
Update
To be clear, my problem is I can't find a way to declare the ITypeInfo interface and allow me to work with it directly - VBA accesses IUnknown
from stole2.tlb so I can use that fine, but the only place I can find ITypeInfo declared is in mscorlib.dll, but it doesn't have the COMVisible attribute so there's no way to access it in VBA, AFAIK, and VBA doesn't have an equivalent to [ComImport]
to let you define it with a GUID yourself. So I want to use tlbinf32.dll to save me having to use raw pointers.
Turns out tlbinf32.dll supports this out of the box but it's hidden. From the help file:
emphasis my own
... similar story for an ITypeInfo pointer
So how to use? Quite simple. First a way to get the IUnknown from a pointer. e.g:
Followed by the call
or words to that effect