다음을 통해 공유


Implementing an Interface (Visual C++)

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Implementing an Interface (Visual C++).

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 Adding Objects and Controls to an ATL Project for a list of wizards that add objects to your ATL project.

Note

The wizard does not support ATL dialogs, XML Web services using ATL, performance objects, or performance counters.

If you add an ATL control, you can specify whether to implement default interfaces, listed on the Interfaces page of that wizard and defined in atlcom.h.

Once you have added the object or control, you can implement other interfaces, located in any available type library, using the Implement Interface Wizard.

If you are adding a new interface, you must add it manually to the project's .idl file. See Adding a New Interface in an ATL Project for more information.

To implement an interface

  1. In Class View, right-click the class name for your ATL object.

  2. Click Add from the shortcut menu, and then click Implement Interface to display the Implement Interface Wizard.

  3. Select the interfaces to implement from the appropriate type libraries and click Finish.

  4. In Class View, expand the object's Bases and Interfaces node to see the interface you have implemented, and 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.

See Also

Creating a COM Interface
Editing a COM Interface