Storage Persistence

The IPersistStorage interface supports structured storage for embedded objects. The interface includes the following methods:

Method Description
HandsOffStorage Requests that the object release all storage objects that its container has passed to it and enter HandsOffAfterSave or HandsOffFromNormal mode.
InitNew Initializes a new storage object.
IsDirty Indicates whether the object has changed since it was last saved to its current storage.
Load Initializes an object from its existing storage.
Save Saves an object, and any nested objects that it contains, into the specified storage object. The object enters NoScribble mode.
SaveCompleted Notifies the object that it can revert from NoScribble or HandsOff mode, in which it must not write to its storage object, to Normal mode, in which it can.

For details, see the COM Programmer's Reference in the Platform Software Development Kit (SDK).

While hosts typically look for stream persistence preferentially, it's a good idea to implement IPersistStorage anyway, to make the designer as flexible and as general as possible. A simple approach is to open a stream in the storage and save the required data.