Compartilhar via


OleSaveToStream (Windows CE 5.0)

Send Feedback

This function saves an object with the IPersistStream:IPersist interface on it to the specified stream.

WINOLEAPI OleSaveToStream(IPersistStream* pPStm,IStream* pStm);

Parameters

  • pPStm
    [in] Pointer to the IPersistStream interface on the object to be saved to the stream.

    The pPStm parameter cannot be NULL.

  • pStm
    [in] Pointer to the IStream interface on the stream that the object is to be saved in.

Return Values

The following HRESULT values can be returned.

Value Description
S_OK The object was saved.
OLE_E_BLANK The pPStm parameter is NULL.
STG_E_MEDIUMFULL There is no space left on device to save the object.

This function can also return any error value returned by the WriteClassStm function or the IPersistStream::Save 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:

  • Calls the IPersistStream::GetClassID method to get the object's CLSID.
  • Writes the CLSID to the stream with the WriteClassStm function.
  • Calls the IPersistStream::Save method with fClearDirty set to TRUE, which clears the dirty bit in the object.

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

To determine whether the platform supports this function, see Determining Supported COM APIs.

Requirements

OS Versions: Windows CE 3.0 and later.
Header: Ole2.h.
Link Library: Ole32.lib.

See Also

Automation Functions | IPersistStream:IPersist | IStream | WriteClassStm | IPersistStream::Save | WriteClassStm | OleLoadFromStream | Determining Supported COM APIs

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.