Implement an interface (original) (raw)

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.

Note

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:

  1. In Class View, right-click the class name for your ATL object.
  2. Choose Add from the shortcut menu, and then choose Implement Interface to display the implement interface wizard.
  3. Select the interfaces to implement from the appropriate type libraries and select Finish.
  4. 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.
    Note
    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.