The IPropertyStorage interface manages the persistent properties of a single property set. Persistent properties consist of information that can be stored persistently in a property set, such as the summary information associated with a file. This contrasts with run-time properties associated with Controls and Automation, which can be used to affect system behavior. Use the methods of the
IPropertySetStorage interface to create or open a persistent property set. An instance of the
IPropertySetStorage interface can manage zero or more
IPropertyStorage instances.
Each property within a property set is identified by a property identifier (ID), a four-byte ULONG value unique to that set. You can also assign a string name to a property through the
IPropertyStorage interface.
Property IDs differ from the dispatch IDs used in Automation dispid property name tags. One difference is that the general-purpose use of property ID values zero and one is prohibited in
IPropertyStorage, while no such restriction exists in IDispatch. In addition, while there is significant overlap among the data types for property values that may be used in
IPropertyStorage and IDispatch, the property sets are not identical. Persistent property data types used in
IPropertyStorage methods are defined in the
PROPVARIANT structure.
The
IPropertyStorage interface can be used to access both simple and nonsimple property sets. Nonsimple property sets can hold several complex property types that cannot be held in a simple property set. For more information see
Storage vs. Stream for a Property Set.
Syntax
|
interface IPropertyStorage : IUnknown
|
When To Implement
Implement
IPropertyStorage when you want to store properties in an object. If you are using the COM compound files implementation, the compound file object created through a call to
StgCreateDocfile includes an implementation of
IPropertySetStorage, which allows access to the implementation of
IPropertyStorage. Once you have a pointer to any of the interface implementations (such as
IStorage) on this object, you can call QueryInterface to get a pointer to the
IPropertySetStorage interface implementation, and then call either the
Open or
Create method, as appropriate to obtain a pointer to the
IPropertyStorage interface managing the specified property set.
When To Use
Use
IPropertyStorage to create and manage properties that are stored in a given property set.
Methods
The IPropertyStorage interface inherits the methods of the IUnknown interface.
In addition, IPropertyStorage defines the following methods.
| Method | Description |
ReadMultiple | Reads property values in a property set. |
WriteMultiple | Writes property values in a property set. |
DeleteMultiple | Deletes properties in a property set. |
ReadPropertyNames | Gets corresponding string names for given property identifiers. |
WritePropertyNames | Creates or changes string names corresponding to given property identifiers. |
DeletePropertyNames | Deletes string names for given property identifiers. |
SetClass | Assigns a CLSID to the property set. |
Commit | As in IStorage::Commit, flushes or commits changes to the property storage object. |
Revert | When the property storage is opened in transacted mode, discards all changes since the last commit. |
Enum | Creates and gets a pointer to an enumerator for properties within this set. |
Stat | Receives statistics about this property set. |
SetTimes | Sets modification, creation, and access times for the property set. |
Requirements
| Client | Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation 3.1 and later, Windows Me, Windows 98, or Windows 95. |
| Server | Requires Windows Server 2008, Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0. |
| Header | Declared in Propidl.h; include Objbase.h. |
| IDL | Declared in Propidl.idl. |
| Library | Use Uuid.lib. |
| DLL | Requires Ole32.dll. |
| IID | IID_IPropertyStorage is defined as 00000138-0000-0000-C000-000000000046. |
See Also
Managing
Properties
Property
Storage Considerations
IPropertySetStorage
IEnumSTATPROPSTG
IEnumSTATPROPSETSTG
STATPROPSTG
STATPROPSETSTG
PROPVARIANT
IPropertyStorage-Compound File Implementation
IPropertyStorage-NTFS File System Implementation
IPropertyStorage-Stand-alone Implementation
Samples
Send comments about this topic to Microsoft
Build date: 8/12/2008