Share via


Editing a COM Interface

By using commands from the Class View shortcut menu, you can define new methods and properties for the COM interfaces in your Visual C++ projects. In addition, from the Toolbox, you can define events for ActiveX controls.

For ATL- and MFC-based COM object classes, you can edit the class implementation at the same time that you edit the interface.

Note

For interfaces that you have defined outside of the Add Class dialog box, Visual C++ adds the methods or properties to the .idl file, and it add stubs to the classes that implement methods, even when the interfaces are added manually.

The following three wizards help you customize existing interfaces. They are available from Class View:

Wizard

Project type

Add Property Wizard

ATL or MFC projects supporting ATL. Right-click the interface to which you want to add the property.

Visual C++ detects the project type and modifies the options in the Add Property Wizard accordingly:

  • For dispinterfaces in projects created by using the MFC Application Wizard, invoking the Add Property Wizard provides options specific to MFC.

  • For MFC ActiveX control interfaces, the Add Property Wizard provides a list of stock methods and properties that you can use as provided or customize for your control.

  • For all other interfaces, the Add Property Wizards provide options useful in most situations.

Add Method Wizard

ATL or MFC projects supporting ATL. Right-click the interface to which you want to add the method.

Visual C++ detects the project type and modifies the options in the Add Method Wizard accordingly:

  • For dispinterfaces in projects created by using the MFC Application Wizard, invoking the Add Method Wizard provides options specific to MFC.

  • For MFC ActiveX control interfaces, the Add Method Wizard provides a list of stock methods and properties that you can use as provided or customize for your control.

  • For all other interfaces, the Add Method wizards provide options useful in most situations.

Additionally, you can implement new interfaces on your COM control by right-clicking the object's control class in Class View and clicking Implement Interface.

See Also

Concepts

Adding Functionality with Code Wizards

Visual C++ Project Types

Other Resources

Working with Resource Files