Much of OLE is concerned with different ways to exchange data between an object and a client. As part of the set of available methods, OLE offers three property-oriented technologies.
The first is the user interface standard called property sheets. Property sheets allow an end user to directly manipulate an object's properties, complementing the comparable programmatic ability that is exposed through an object's custom interfaces and dispinterfaces. A property sheet is a dialog—invoked through an OLE API function—that contains one or more property pages. Each page displays a collection of properties. In OLE, each page is a separate component with its own CLSID. Each component has one object that implements the interface IPropertyPage. Through this interface, the property page is given pointers to the objects being manipulated and is also told when to send changes to those objects. Because an object has to know what changes to expect from property pages, it implements the interface ISpecifyPropertyPages to provide the CLSIDs of the pages it supports. Property pages of this sort are demonstrated using an enhancement of the Beeper object from Chapter 14 and the AutoCli sample from Chapter 15.
Objects can also support per-property browsing by implementing IPerPropertyBrowsing. Through this interface, a client can ask an object for a specific property to highlight when that object's property sheet appears. Property pages that also support this feature implement IPropertyPage2 so the object can be told to set the focus to a particular field for the appropriate property. In addition, a client can use IPerPropertyBrowsing to retrieve lists of information from an object that are appropriate to display in user interface elements such as drop-down list boxes.
The second property-oriented technology is an interface named IPropertyNotifySink. Through IPropertyNotifySink, a client can receive change requests and change notifications from an object for any number of properties. To receive requests and notifications, a client implements a sink object with IPropertyNotifySink and connects it to an object through the connection point interfaces described in Chapter 4. For any object property marked "requestedit" in the object's type information, the object will call IPropertyNotifySink::OnRequestEdit, giving the client a chance to allow or deny a change to the property. For any property marked "bindable" (regardless of whether it is marked "requestedit"), the object will call IPropertyNotifySink::OnChanged when that property changes. A client can do whatever it wants with this notification.
The third property technology is a standard for persistent stream (or storage) layout called property sets, a sparse, flexible, and extensible stream format. A specific property set is a specification of a certain collection of properties that might appear in a stream. Each property set is assigned a format identifier (FMTID), which is a GUID that sets it off from all others. Within a property set, individual sections are stored, and each section contains a list of properties. Each property is marked with a type from the VARTYPE enumeration, followed by a variable length stream of bytes that determines the value of that property. Literally any type of property can be stored in this manner, and the sparse layout concept means that any code reading a property set can easily and robustly skip over those properties or sections that it does not recognize.
One property set of general interest to operating systems such as Windows 95 is named Summary Information (contained in a stream with the name "\005SummaryInformation"). This stream contains a document's title, subject, author, keywords, comments, creation time, last saved time, last printed time, and so forth—in other words, general document properties. The Windows 95 shell can display these properties on request, and future systems will use them to match a user's specified search criteria. Because a property set is easily extracted from a stream in a compound file, the application that created that file does not need to be launched simply to display or otherwise read the contents in that stream. This gives the user full and fast access to document properties.