Being able to compile it doesn't mean it works. Read Igor's
to address that properly. If you search this group's archives
implement multiple dual interfaces on a COM object.
On 10 Jul., 14:06, "Igor Tandetnik" <itandet...@mvps.org> wrote:
"Axel Bock" <axel.bock.n...@googlemail.com> wrote in message
I have two DLL's with COM components. DLL one defines an interface
IMyInterface. I know want to have a 2nd DLL to have a class which
implements that interface, too.
// ADDED BY ME
// THE REST IS WIZARD CODE
You are trying to get C++ compiler to compile IDL. Of course IDL syntax
is not valid C++, I expect you get tons of errors.
nah, I mistyped - this is in fact a .h file. :-) that happens when you
manually reduce your examples.
Either use #import, or include the .h file that MIDL compiler generated
The error message suggests that both interfaces you are trying to
implement are dual - that is, both derive from IDispatch. So now you
have two distinct implementations of IDispatch in your coclass. Think
about it - when a client queries for IDispatch, which one should it
get? Which methods should it be able to access via late binding?
I got that far - I know C++ all right. But I could not get my head
around that ATL magic which causes the error.
You should avoid implementing two dual interfaces on the same object. If
you have to, it's a sign of a design, shall we say, not very well
thought through. If, for some reason, you really really need to
implement two dual interfaces, you would have to provide a custom
IDispatch implementation that enables late binding access to both sets
Actually I think I got it. I found something in the internet, which
hinted me to an "Implement interface" wizard of Visual Studio, which
solved the problem just fine. Whyever. Like I said - I know it works,
but I don't know how. I know the concepts of COM and how it works, but
in _practical_ detail ... well :-) .
Thanks for your reply, I will post if what I have found is not
Greetings & thanks again,