Adding a New Interface in an ATL Project
When you add an interface to your object or control, you create stubbed-out functions for each method in that interface. In your object or control, you can add only interfaces currently found in an existing type library. Also, the class in which you add the interface must implement the BEGIN_COM_MAP macro or, if the project is attributed, it must have the coclass
attribute.
You can add a new interface to your control in one of two ways: manually or using code wizards in Class View.
To use code wizards in Class View to add an interface to an existing object or control
In Class View, right-click the class name of a control. For example, a full control or composite control, or any other control class that implements a BEGIN_COM_MAP macro in its header file.
On the shortcut menu, click Add, and then click Implement Interface.
Select the interfaces to implement in the Implement Interface Wizard. If the interface does not exist in any available typelib, then you must add it manually to the .idl file.
To add a new interface manually
Add the definition of your new interface to the .idl file.
Derive your object or control from the interface.
Create a new COM_INTERFACE_ENTRY for the interface or, if the project is attributed, add the
coclass
attribute.Implement methods on the interface.
See also
ATL Project Wizard
C++ project types in Visual Studio
Programming with ATL and C Run-Time Code
Fundamentals of ATL COM Objects
Default ATL Project Configurations