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. 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 Simple 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.