Editing COM Interfaces

OverviewHow Do I ... Topics

By using commands from the ClassView****shortcut menu, you can easily define new methods and properties for the COM interfaces in your Visual C++ projects. In addition, 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 , the New Class dialog box, or the MFC ClassWizard, Visual C++ adds the methods or properties to the .idl or .odl file, but doesn’t directly modify your implementation class.

You can use the Add Method, Add Property, and Add Event dialog boxes, available from ClassView, to customize existing interfaces. Visual C++ detects the project type, and modifies the options in the dialog boxes accordingly:

  • For dispinterfaces in projects created by using the MFC AppWizard, or classes created by using ClassWizard, invoking the Add Method or Add Property dialog box provides options specific to MFC and ClassWizard.

    Note   The MFC variant of these dialog boxes can also be invoked from the OLE Automation tab of the ClassWizard dialog box, for automation-capable classes.

  • For MFC ActiveX control interfaces, the Add Method, Add Property, and Add Event dialog boxes provide 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 and Add Property dialog boxes provide options useful in most situations.

What do you want to do?

Add a method to an interface or non-MFC dispinterface

Add a method to an MFC dispinterface

Add a property to an interface or non-MFC dispinterface

Add a property to an MFC dispinterface

Add a method, property, or event to an MFC ActiveX control