Dual Interfaces and Events

Dual Interfaces and ATL

While it is possible to design an event interface as a dual, there are a number of good design reasons not to do so. The fundamental reason is that the source of the event will only fire the event via the vtable or via Invoke, not both. If the event source fires the event as a direct vtable method call, the IDispatch methods will never be used and it's clear that the interface should have been a pure vtable interface. If the event source fires the event as a call to Invoke, the vtable methods will never be used and  it's clear that the interface should have been a dispinterface. If you define your event interfaces as duals, you'll be requiring clients to implement part of an interface that will never be used.

Note   This argument also applies to any dual interface. From a design perspective, it is preferable to design a separate vtable interface and dispinterface, so that each can be used or implemented separately if they should need to be reused. (From an implementation perspective, duals are a quick, convenient, and well-supported way of implementing interfaces that are accessible to a wide range of clients.)

Pragmatically, there are further reasons to avoid dual event interfaces — neither Visual Basic nor Internet Explorer support them.