OleSaveToStream  1CHH5WM

Saves an object with the IPersistStream4KTV_NZ interface on it to the specified stream.

WINOLEAPI OleSaveToStream(

    IPersistStream * pPStm,

//Pointer to the interface on the object to be saved

    IStream * pStm

//Pointer to the destination stream to which the object is saved

   );

 

 

Parameters

pPStm

[in] Pointer to the IPersistStream interface on the object to be saved to the stream. Can be NULL, which has the effect of writing CLSID_NULL to the stream.

pStm

[in] Pointer to the IStream interface on the stream in which the object is to be saved.

 

Return Values

S_OK

The object was successfully saved.

STG_E_MEDIUMFULL

There is no space left on device to save the object.

 

This function can also return any of the error values returned by the WriteClassStmEVYOCB function or the IPersistStream::Save5_V3OT method.

 

Remarks

This function simplifies saving an object that implements the IPersistStream interface to a stream. In this stream, the object s CLSID precedes its data. When the stream is retrieved, the CLSID permits the proper code to be associated with the data. The OleSaveToStream function does the following:

  1.  Calls the IPersistStream::GetClassID method to get the object s CLSID.

  2.  Writes the CLSID to the stream with the WriteClassStmEVYOCB function.

  3.  Calls the IPersistStream::Save5_V3OT method with fClearDirty set to TRUE, which clears the dirty bit in the object.

The companion helper, OleLoadFromStream, loads objects saved in this way.

 

See Also

OleLoadFromStream, IPersistStream, IStream