OleSave function (ole2.h)
Saves an object opened in transacted mode into the specified storage object.
Syntax
HRESULT OleSave(
[in] LPPERSISTSTORAGE pPS,
[in] LPSTORAGE pStg,
[in] BOOL fSameAsLoad
);
Parameters
[in] pPS
Pointer to the IPersistStorage interface on the object to be saved.
[in] pStg
Pointer to the IStorage interface on the destination storage object to which the object indicated in pPS is to be saved.
[in] fSameAsLoad
TRUE indicates that pStg is the same storage object from which the object was loaded or created; FALSE indicates that pStg was loaded or created from a different storage object.
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.
This function can also return any of the error values returned by the IPersistStorage::Save method. |
Remarks
The OleSave helper function handles the common situation in which an object is open in transacted mode and is then to be saved into the specified storage object which uses the OLE-provided compound file implementation. Transacted mode means that changes to the object are buffered until either of the IStorage::Commit or IStorage::Revert is called. Callers can handle other situations by calling the IPersistStorage and IStorage interfaces directly.
OleSave does the following:
- Calls the IPersist::GetClassID method to get the CLSID of the object.
- Writes the CLSID to the storage object using the WriteClassStg function.
- Calls the IPersistStorage::Save method to save the object.
- If there were no errors on the save; calls the IStorage::Commit method to commit the changes.
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 | ole2.h |
Library | Ole32.lib |
DLL | Ole32.dll |
API set | ext-ms-win-com-ole32-l1-1-3 (introduced in Windows 10, version 10.0.10240) |