OleSaveToStream function (ole.h)
Saves an object with the IPersistStream interface on it to the specified stream.
Syntax
OLESTATUS OleSaveToStream(
LPOLEOBJECT unnamedParam1,
LPOLESTREAM unnamedParam2
);
Parameters
unnamedParam1
Pointer to the IPersistStream interface on the object to be saved to the stream. The pPStm parameter cannot be NULL.
unnamedParam2
Pointer to the IStream interface on the stream in which the object is to be saved.
Return value
This function returns S_OK on success. Other possible values include the following.
Return code | Description |
---|---|
|
The object could not be saved due to lack of disk space. |
|
The pPStm parameter is NULL. |
This function can also return any of the error values 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 IPersist::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.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | ole.h (include Ole2.h) |
Library | Ole32.lib |
DLL | Ole32.dll |
API set | ext-ms-win-com-ole32-l1-1-1 (introduced in Windows 8.1) |