Implement an interface
To implement an interface, you must have created a project as an ATL COM application or as an MFC application that contains ATL support. You can use the ATL project wizard to create an ATL application, or add an ATL object to your MFC application to implement ATL support for an MFC application.
Once you create the project, to implement an interface, you must first add an ATL object. See Add objects and controls to an ATL project for a list of wizards that add objects to your ATL project.
The wizard doesn't support ATL dialog boxes, XML Web services using ATL, performance objects, or performance counters.
If you add an ATL control, you can specify whether to implement default interfaces. The default interfaces are listed on the Interfaces page of that wizard and defined in atlcom.h.
Once you've added the object or control, you can implement other interfaces, located in any available type library, using the Implement Interface Wizard.
If you're adding a new interface, you must add it manually to the project's .idl file. For more information, see Add a new interface in an ATL project.
To implement an interface:
In Class View, right-click the class name for your ATL object.
Choose Add from the shortcut menu, and then choose Implement Interface to display the implement interface wizard.
Select the interfaces to implement from the appropriate type libraries and select Finish.
In Class View, expand the object's Bases and Interfaces node to see the interface you've implemented. Then expand the interface's node to see its available properties, methods, and events.
You can also use the object browser to examine the members of the interface.
In this section
Implement interface wizard
This wizard implements an interface for a COM object. Implementations of many interfaces are included in the COM libraries available with Visual Studio and Windows. An interface implementation is associated with an object when an instance of that object is created. It also provides the services that the object offers.
For a discussion of interfaces and implementations, see Interfaces and interface implementations in the Windows SDK.
Implement interface from
Specifies the location of the type library, from which the interface is created.
Option Description Project The type library is part of the project. Registry The type library is registered in the system. Registered type libraries are listed in Available type libraries. File The type library isn't necessarily registered in the system but is held in a file. Provide the file location in Location.
Available type libraries
Displays the available type libraries holding the interface definitions that you can implement. If you choose File under Implement interface from, this box is unavailable for change.
Displays the location of the type library currently selected in the Available type libraries list. If you selected File under Implement interface from, select the ellipsis button to locate a file holding the type library to use.
Displays the interfaces whose definitions are held in the type library currently selected in the Available type libraries box.
Interfaces that have the same name as those already implemented by the selected object aren't displayed in the Interfaces box.
Transfer button Description > Adds to the Implement interfaces list the interface name currently selected in the Interfaces list. >> Adds to the Implement interfaces list all interface names available in the Interfaces list. < Removes the interface name currently selected in the Implement interfaces list. << Removes all interface names currently listed in the Implement interfaces list.
Displays the names of the interfaces that you've selected to implement on your object.
If you include more than one interface that derives from
IDispatch, or if you try to implement an interface that's derived from another interface already on your class, then you must disambiguate the COM_MAP entries. For more information, see COM_INTERFACE_ENTRY2.
Submit and view feedback for