
Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Hello Mattias:
The COM object (coclass) implements A, B, C all of which are derived from
IDispatch and A is the default.
I did try,
Dim obj1 as B = foo.GetObj1 and
Dim obj1 as B = CType(foo.GetObj1, B)
and got the same MissingMemberException. Now the returned object (obj1)
actually implements A, B, C but I want "someMethod" to be invoked via B not
A which is the default. This is because the COM component differentiates
between whose IDispatch is used and does different things. I did not write
it so I can explain this design decision !
The IDL contains only one coclass, so "foo" and "obj1" are instances of the
same class. The difference is "GetObj1()" returns a ptr to B after
performing the appropriate cast.
Further NONE of the methods (GetObj1(), someMethod()) are described in the
typelib.
I finally got the following to work,
GetType(B).InvokeMember("someMethod", ..., obj1,...)
I would appreciate it if you could explain why your suggested approach did
not work. I would prefer to use that as it is more intuitive.
Thanks
Lawrence
> Lawrence,
>
[quoted text clipped - 10 lines]
>
> Mattias