Managing Properties

Most ActiveX designers allow end users to view and change properties of objects. A designer can support property browsing in several ways, which are summarized in the following table:

Level of Support Required Interfaces
Browsing only. IDispatch and either IProvideClassInfo or IProvideDynamicClassInfo.
Use host's Properties window to view and change properties. Those listed above, plus IConnectionPointContainer, IConnectionPoint, and IPropertyNotifySink.
Use property pages. Those listed above, plus IPerPropertyBrowsing, IPropertyPage, IPropertyPage2, IPropertyPageSite, and ISpecifyPropertyPages.

For maximum flexibility, designers should support all three methods.

Browsing Only

If the designer allows users only to browse properties through the host's Properties window, and does not allow them to change any properties, it must support IDispatch. The host gains access to the set of properties to browse through the designer's implementation of IProvideClassInfo or IProvideDynamicClassInfo.

The IDispatch interface, defined as part of Automation, allows access to the properties and methods of an ActiveX object. For ActiveX designers that do not support any other property-browsing mechanism, the host can change property values by calling the IDispatch methods of the objects.

Using the Host's Properties Window

If the properties can change in any way other than through the property browser, the ActiveX designer must support the connection point interfaces and IPropertyNotifySink in addition to IDispatch and one of the type information interfaces. The designer uses connection point interfaces to inform the host's property browser of changes to properties. See "Handling Events" in this chapter for more information on these interfaces.

Using Property Pages

ActiveX designers also can support their own property browsing through the property page mechanism. This approach provides the most general, host-independent code of all the property browsing methods.

A property page allows users to change and view properties. Each property page is associated with an object and allows the end user to edit properties for that object. An object can have more than one property page; each page handles a group of related properties.

Users access property pages through a property frame. The property frame displays the property pages that apply to an object (or a set of objects). Through the host's Properties window, users can access the property frame for an ActiveX designer object.

The following Application Programming Interfaces (APIs) and interfaces handle the interactions between objects and their properties, property pages, and property frames:

See the OLE Programmer's Reference for details of the property management interfaces.