Adding a New Interface to an Existing Object or Control
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 only add interfaces currently found in an existing type library. Also, the class in which you add the interface must implement the BEGIN_COM_MAP macro.
There are two ways to add a new interface to your control or object: manually and via ClassView.
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.
Implement methods on the interface.
To use ClassView to add an interface to an existing object or control
Make sure that your workspace is visible by selecting Workspace from the View menu.
In the Workspace, select the ClassView tab.
Right-click on 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. You will see a pop-up menu with the Implement Interface... option.
Select the Implement Interface... option to display the Implement Interface dialog box.
If there is a new interface in your project’s type library, you will see the interface displayed in the Interfaces list. You can also click AddTypelib... and select one or more type libraries from the Browse Type Libraries dialog box.
Select interfaces from the available type libraries in the Implement Interface dialog box and click OK. This process adds a TLH file to your project directory for each object in which you selected one or more interfaces.