I am getting the address of a COM function by loading type library (TLB) and iterating over types using ITypeLib
and ITypeInfo
.
After calling the AddressOfMember
function of ITypeInfo I am facing the following exception:
System.Runtime.InteropServices.COMException (0x800288BD): Wrong module kind for the operation. (Exception from HRESULT: 0x800288BD (TYPE_E_BADMODULEKIND)) at System.Runtime.InteropServices.ComTypes.ITypeInfo.AddressOfMember(Int32 memid, INVOKEKIND invKind, IntPtr& ppv).
How do I get rid of this exception?
I'm not sure, haven't done this type of thing before, but you say you are loading the tlb file? It might be that for addressofmember you need to load the dll that contains the com object, I thought the tlb file was just a description of the interfaces, and thus addressofmember wouldn't have any code to load.
User contributions licensed under CC BY-SA 3.0