Re: using IDispEventImpl
- "paul_e_ingalls" <paulingalls@...>
wrote in message news:bdrb1e+48jj@......
> Thanks Igor. I had the event map as well, I was simply confused byIDispEvent[Simple]Impl uses an interesting trick for implementing split
> the COM map results. It seems strange that, though IDispEvent
> [Simple]Impl implements IDispatch, it doesn't derive from it. But
> hey, if it works, use it.
identity, so called interface coloring. You see, if it were to derive
from IDispatch, you would not be able to a) derive from IDispEventImpl
more than once, which you usually want if you, say, host multiple
ActiveX controls; b) implement IDispatch on the same object that derives
from one or more IDispEventImpl.
The way it works, an interface is defined having all the same virtual
methods as IDispatch with all the same signatures, but named
differently. A vtable layout of this interface is binary compatible with
IDispatch, and that's all COM is concerned with - at run-time, a pointer
to this "colored" interface can be used anywhere a pointer to real
IDispatch would be accepted. Renaming the methods makes compiler happy,
With best wishes,
"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken