The ability to discover and access an object's properties at run time is a feature with many applications. Writing a generic property browser is easier given a consistent interface to an object's properties. For example, Visual Basic is able to use the same property browser for any ActiveX control, because ActiveX controls implement ITypeInfo and IDispatch. Of course, implementing ITypeInfo is a challenge, unless you are working with a COM object that has a type library. The Properties package provides a simple set of interfaces and classes for doing the same type of thing for any C++ object. It even provides an implementation of those interfaces for ActiveX controls, so that properties for both C++ objects and ActiveX controls can be manipulated in a consistent manner.
The IProperty interface provides a description of a given property. Each property has a LONG identifier associated with it. This is the same data type as a DISPID, which makes it easy to use the SFL properties interface to access the properties of an ActiveX control. The symbol PropertyId is used to declare property identifiers and is typedefed as LONG. Each property also has a name, description, data type, style flags, and an enumeration. Property values are stored and retrieved as VARIANTs, because it is convenient and integrates with ActiveX control properties. Accordingly, the data type for a property is described by a VARTYPE. Both MFC and ATL provide a CComVariant class that makes it easy to work with VARIANTs. The CProperty class provides a straightforward implementation of the IProperty interface and is sufficient for most applications.
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.