Loading ...
Sorry, an error occurred while loading the content.

Re: using IDispEventImpl

Expand Messages
  • Igor Tandetnik
    paul_e_ingalls wrote in message news:bdrb1e+48jj@eGroups.com... ... IDispEvent[Simple]Impl uses an interesting trick for
    Message 1 of 10 , Jul 1, 2003
    • 0 Attachment
      "paul_e_ingalls" <paulingalls@...>
      wrote in message news:bdrb1e+48jj@......
      > Thanks Igor. I had the event map as well, I was simply confused by
      > 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.

      IDispEvent[Simple]Impl uses an interesting trick for implementing split
      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,
      Igor Tandetnik

      "For every complex problem, there is a solution that is simple, neat,
      and wrong." H.L. Mencken
    Your message has been successfully submitted and would be delivered to recipients shortly.