Skip to content

Latest commit

 

History

History
59 lines (53 loc) · 3.43 KB

File metadata and controls

59 lines (53 loc) · 3.43 KB
title Editing a COM Interface | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.technology
cpp-ide
ms.tgt_pltfrm
ms.topic article
f1_keywords
vc.codewiz.com.editing.interfaces
dev_langs
C++
helpviewer_keywords
methods [C++], adding to COM interfaces
COM interfaces, editing
properties [C++], adding to COM interfaces
ms.assetid 6c2909e0-af2d-4a37-bb39-ed372e6129cf
caps.latest.revision 6
author mikeblome
ms.author mblome
manager ghogen
translation.priority.ht
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

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

Working with Resource Files
Adding Functionality with Code Wizards
Visual C++ Project Types