Managing Property Sets

A persistent property set contains related pieces of information in the form of properties. Each property set is identified with a FMTID, a GUID that allows programs accessing the property set to identify the property set and, through this identification, know how to interpret the properties it contains. Examples of property sets might be the character-formatting properties in a word processor or the rendering attributes of an element in a drawing program.

COM defines the IPropertySetStorage interface to facilitate management of property sets. Through the methods of this interface, you can create a new property set, or open or delete an existing property set. In addition, it provides a method that creates an enumerator and supplies a pointer to its IEnumSTATPROPSETSTG interface. You can call the methods of this interface to enumerate STATPROPSETSTG structures on your object, which will provide information about all of the property sets on the object.

When you create or open an instance of IPropertyStorage, it is similar to opening an object that supports IStorage or IStream, because you need to specify the storage mode in which you are opening the interface. For IStorage, these include the transaction mode, the read/write mode, and the sharing mode.

When you create a property set with a call to IPropertySetStorage::Create, you specify whether the property set is to be simple or non-simple. A simple property set contains types that can be fully written within the property set stream, which is intended to be limited, and can, in fact, not be larger than 256 Kbytes. However, for those cases when you need to store a larger amount of information in the property set, you can specify that the property set be non-simple, allowing you to use one or more of the types that specify only a pointer to a storage or stream object. Also, if you need a transacted update, the property set must be non-simple. There is, of course, a certain performance penalty for opening these types, because it requires opening the stream or storage object to which you have the pointer.

If your application uses compound files, you can use the COM-provided implementation of these interfaces, which are implemented on the COM compound file storage object.

Each property set consists primarily of a logically connected group of properties, as described in the following section.