OleSave (Windows CE 5.0)

Send Feedback

This function saves an object opened in transacted mode into the specified storage object.

WINOLEAPI OleSave(IPersistStorage* pPS,IStorage* pStg,BOOLfSameAsLoad);

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 that the object indicated in pPS is to be saved to.
  • fSameAsLoad
    [in] Boolean that is set to TRUE if pStg is the same storage object from which the object was loaded or created, or to FALSE if pstg was loaded or created from a different storage object.

Return Values

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::Save method.

Remarks

Passing invalid (and under some circumstances NULL) pointers into this function causes an unexpected termination of the application.

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 that 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 IStorage interfaces directly.

OleSave does the following:

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

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

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

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

    **Note   **Static objects are saved into a stream called CONTENTS.

    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.

    IStream

    IDataObject::GetDataHere

    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

OS Versions: Windows CE 2.0 and later.
Header: Ole2.h.
Link Library: Ole32.lib.

See Also

Automation Functions | IPersistStorage | IStorage | IPersistStorage::Save | IStorage | WriteClassStg | IPersistStorage::Save | IStorage::Commit | IStream | IDataObject::GetDataHere | Determining Supported COM APIs

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.