The IPropertyBag InterfaceThe IPropertyBag Interface*
*Contents  *Index  *Topic Contents
*Previous Topic: IPersistPropertyBag::Save
*Next Topic: IPropertyBag::Read

The IPropertyBag Interface

When a client wants to have exact control over how individually named properties of an object are saved, it would attempt to use an object's IPersistPropertyBag interface as a persistence mechanism. In that case, the client supplies a "property bag" to the object in the form of an IPropertyBag interface.

IDL:

[
uuid(55272A00-42CB-11CE-8135-00AA004BB851)
    , object, pointer_default(unique)
]
interface IPropertyBag : IUnknown
    {
    HRESULT Read([in] LPCOLESTR pszPropName, [in,out] VARIANT *pVar
        , [in,out] IErrorLog *pErrorLog);
    HRESULT Write([in] LPCOLESTR pszPropName, [in] VARIANT *pVar);
    };

When the object wishes to read a property in IPersistPropertyBag::Load, it will call IPropertyBag::Read. When the object is saving properties in IPersistPropertyBag::Save, it will call IPropertyBag::Write. Each property is described with a name in pszPropName whose value is exchanged in a VARIANT. This information allows a client to save the property values as text, for instance, which is the primary reason why a client might choose to support IPersistPropertyBag.

The client records errors that occur during Read into the supplied "error log."

arrowg.gifIPropertyBag::Read

arrowg.gifIPropertyBag::Write


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.