OleSave  LFU4K8

Saves an object opened in transacted mode into the specified storage object.

WINOLEAPI OleSave(

    IPersistStorage * pPS,

//Pointer to the object to be saved

    IStorage * pStg,

//Pointer to the destination storage to which pPS is saved

    BOOL fSameAsLoad

//Whether the object was loaded from pstg or not

   );

 

 

Parameters

pPS

[in] Pointer to the IPersistStorage interface on the object to be saved.

pStg

[in] Pointer to the IStorage interface on the destination storage object to which the object indicated in pPS is to be saved.

fSameAsLoad

[in] 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 Values

S_OK

The object was successfully saved.

STG_E_MEDIUMFULL

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::SaveS4I7H8 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 methods Commit or Revert is called. Callers can handle other situations by calling the IPersistStorage and IStorageFS1VT1 interfaces directly.

OleSave does the following:

  1.  Calls the IPersistStorage::GetClassID method to get the CLSID of the object.

  2.  Writes the CLSID to the storage object using the WriteClassStgEVYOC. function.

  3.  Calls the IPersistStorage::SaveS4I7H8 method to save the object.

  4.  If there were no errors on the save; calls the IStorage::CommitW250T5 method to commit the changes.

 

 

Note  Static objects are saved into a stream called CONTENTS. Static metafile objects get saved in  placeable metafile format  and static DIB data gets saved in  DIB file format.  These formats are defined to be the OLE standards for metafile and DIB. All data transferred using an IStream8MD3QE interface or a file (that is, via IDataObject::GetDataHere3OHMFJE) must be in these formats. Also, all objects whose default file format is a metafile or DIB must write their data into a CONTENTS stream using these standard formats.

 

See Also

IStorage, IPersistStorage