Overview | How Do I ... Topics
When defining a property for an MFC ActiveX control interface, you can implement the property with a member variable or with Get/Set methods. Using the member variable implementation provides direct access to the property, whereas using Get and Set methods to implement the property enforces a controlled access. If you do implement the property via a member variable, you can also provide a notification function to alert you when the value of the property changes.
Note The member variable implementation is not valid for text properties such as Caption.
To add a property to an MFC ActiveX control
To create your own property, type in a unique name. If you choose from the list, you can either use the Stock radio button to use inherited behavior, or you can select the Get/Set methods radio button to override the parent classes with your own function implementation.
You cannot modify the type for stock properties.
Your choice is reflected in the two text boxes below the Type drop-down list. By default, Member variable is selected, displaying the Variable name and Notification function text boxes. Selecting Get/Set methods displays the Get function and Set function boxes.
The Parameter list area is unavailable for a member variable implementation, since member variables don’t take parameters.
The new property is displayed as an icon in ClassView under the dispinterface where it is defined. For custom properties, or stock properties with custom implementations, it is also displayed under the class that implements it. You can double-click the icon under the dispinterface to jump to the .odl file, and you can double-click the icon under the class to jump to the .cpp file.