IPersistStream interface (objidl.h)

Enables the saving and loading of objects that use a simple serial stream for their storage needs.


The IPersistStream interface inherits from IPersist. IPersistStream also has these types of members:


The IPersistStream interface has these methods.


Retrieves the size of the stream needed to save the object. (IPersistStream.GetSizeMax)

Determines whether an object has changed since it was last saved to its stream. (IPersistStream.IsDirty)

Initializes an object from the stream where it was saved previously. (IPersistStream.Load)

Saves an object to the specified stream. (IPersistStream.Save)


One way in which this interface is used is to support OLE moniker implementations. Each of the OLE-provided moniker interfaces provides an IPersistStream implementation through which the moniker saves or loads itself. An instance of the OLE generic composite moniker class calls the IPersistStream methods of its component monikers to load or save the components in the proper sequence in a single stream.

IPersistStream URL Moniker Implementation

The URL moniker implementation of IPersistStream is found on an URL moniker object, which supports IUnknown, IAsyncMoniker, and IMoniker. The IMoniker interface inherits its definition from IPersistStream and thus, the URL moniker also provides an implementation of IPersistStream as part of its implementation of IMoniker.

The IAsyncMoniker interface on an URL moniker is simply IUnknown (there are no additional methods); it is used to allow clients to determine if a moniker supports asynchronous binding. To get a pointer to the IMoniker interface on this object, call the CreateURLMonikerEx function. Then, to get a pointer to IPersistStream, call the QueryInterface method.

IPersistStream, in addition to inheriting its definition from IUnknown, also inherits the single method of IPersist, GetClassID.


Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header objidl.h

See also