IPersistPropertyBag  .YE15_

The IPersistPropertyBag interface works in conjunction with IPropertyBagWKL6I0 and IErrorLogDMYUG2 to define an individual property-based persistence mechanism. Whereas a mechanism like IPersistStream gives an object an IStream in which to store its binary data, IPersistPropertyBag provides an object with an IPropertyBag interface through which it can save and load individual properties. The implementer of IPropertyBag can then save those properties in whatever way it chooses, such as name/value pairs in a text file. Errors encountered in the process (on either side) are recorded in an error log through IErrorLog. This error reporting mechanism work on a per-property basis instead of an all properties as a whole basis through just the return value of IPersist*::Load or IPersist*::Save.

The basic mechanism is that a container tells the object to save or load its properties through IPersistPropertyBag. For each property, the object calls the container s IPropertyBag interface passed to the IPersistPropertyBag methods. IPropertyBag::Write saves a property in whatever place the container wants to put it, and IPropertyBag::Read retrieves a property.

This protocol is essentially a means of sequentially communicating individual property values from the object to the container, which is useful for doing save-as-text operations and the like. The object gives the container the choice of the format in which each property is saved, while retaining itself the decision as to which properties are saved or loaded.

When to Implement

An object implements this interface to enable saving its properties persistently.

When to Use

A container calls the methods on this interface to instruct an object to load and save its properties to the supplied property bag.

Methods in Vtable Order

IUnknown1NEM0LU Methods

Description

QueryInterface2Y54585

Returns pointers to supported interfaces.

AddRef1SHW0SS

Increments reference count.

ReleaseDUW01A

Decrements reference count.

 

IPersistHYD1T0 Method

Description

GetClassID15MI_PE

Returns the class identifier (CLSID) for the component object.

 

IPersistPropertyBag Methods

Description

InitNewQCUOIK

Called by the container when the control is initialized to initialize the property bag.

Load5HQ7FY

Called by the container to load the control s properties.

Save279PSL4

Called by the container to save the object s properties.

 

See Also

IErrorLog, IPropertyBag