You can implement a dual interface using the IDispatchImpl class, which provides a default implementation of the IDispatch methods in a dual interface. To use this class:
If you want to create a new interface and a new class to implement it, you can use the ATL Object Wizard to generate a Simple Object.
If you have an existing interface, you can use the Implement Interface Wizard to add the necessary base class, COM map entries, and skeleton method implementations to an existing class.
Note You may need to adjust the generated base class so that the major and minor version numbers of the type library are passed as template arguments to your IDispatchImpl base class. In Visual C++ 6.0, the Implement Interface Wizard doesn't check the type library version number for you.
You can use an IDispatchImpl base class to provide an implementation of a dispinterface just by specifying the appropriate entry in the COM map (using the COM_INTERFACE_ENTRY2 or COM_INTERFACE_ENTRY_IID macro) as long as you have a type library describing a corresponding dual interface. It is quite common to implement the IDispatch interface this way, for example. The ATL Object Wizard and Implement Interface Wizard both assume that you intend to implement IDispatch in this way, so they will add the appropriate entry to the map.
Note ATL offers the IDispEventImpl and IDispEventSimpleImpl classes to help you implement dispinterfaces without requiring a type library containing the definition of a compatible dual interface.