OleSaveToStream function
Saves an object with the IPersistStream interface on it to the specified stream.
Syntax
HRESULT OleSaveToStream( _In_ LPPERSISTSTREAM pPStm, _In_ LPSTREAM 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 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.
The companion helper, OleLoadFromStream, loads objects saved in this way.
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also