Adding a Property

You can use the Add Property Wizard to add a method to an interface in your project.

To add a property to your object

  1. In Class View, right-click the name of the interface to which you want to add the property.


    You can also add properties to dispinterfaces, which, unless the project is attributed, are nested within the library node.

  2. From the shortcut menu, click Add, and then click Add Property.

  3. In the Add Property Wizard, provide the information to create the property.

  4. Specify any interface definition language (IDL) settings for the property in the IDL Attributes page of the wizard.

  5. Click Finish to add the property.

The Get and Put methods of the property are displayed as two icons in Class View, under the interface where it is defined. You can double-click either icon to view the property declaration in the .idl file.

  • For ATL interfaces, the Get and Put functions are added to the .cpp file, and references to these functions are added to the .h file.

  • For MFC dispinterfaces, if you select Member variable as the implementation type, a method and a variable are added to the class that implements it. If you select Get/Set methods as the implementation type, two methods are added to the class that implements it.

See Also


The Component Object Model

Interface Pointers and Interfaces


Creating a COM Interface

Editing a COM Interface