Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function saves an object opened in transacted mode into the specified storage object.
Syntax
WINOLEAPI OleSave( IPersistStorage* pPS, IStorage* pStg, BOOL fSameAsLoad ); |
Parameters
- pPS
-
[in] Pointer to the IPersistStorageinterface on the object to be saved.
- pStg
-
[in] Pointer to the IStorageinterface on the destination storage object that the object indicated in pPSis to be saved to.
- fSameAsLoad
-
[in] Boolean that is set to TRUE if pStgis the same storage object from which the object was loaded or created, or to FALSE if pstgwas loaded or created from a different storage object.
Return Value
This function returns S_OK if the object was saved.
This function returns STG_E_MEDIUMFULL if the object could not be saved due to lack of disk space.
This function can also return any error value returned by the IPersistStorage::Savemethod.
Remarks
Passing invalid (and under some circumstances NULL) pointers into this function causes an unexpected termination of the application.
The OleSavehelper 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 that uses the OLE-provided compound file implementation.
Transacted mode means that changes to the object are buffered until either of the IStoragemethods Commitor Revertis called.
Callers can handle other situations by calling the IPersistStorageand IStorageinterfaces directly.
OleSavedoes the following:
- Calls the
IPersist::GetClassIDmethod to get the CLSID of the object.
- Writes the CLSID to the storage object using the
WriteClassStgfunction.
- Calls the
IPersistStorage::Savemethod to save the object.
- If there were no errors on the save, calls the
IStorage::Commitmethod to commit the changes.
Note: Static objects are saved into a stream called CONTENTS. Note: Static metafile objects get saved in "placeable metafile format." Static DIB data gets saved in DIB file format. These formats are defined to be the OLE standards for metafile and DIB. Note: All data transferred using an IStreaminterface or a file transferred using IDataObject::GetDataHeremust be in these formats. Note: Also, all objects whose default file format is a metafile or DIB must write their data into a CONTENTS stream using these standard formats.
To determine whether the platform supports this function, see Determining Supported COM APIs.
Requirements
Header | ole2.h |
Library | ole32.lib |
Windows Embedded CE | Windows CE 2.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |