Saves an object, and any nested objects that it contains, into the specified storage. The object is placed in NoScribble mode, and it must not write to the specified storage until it receives a call to its IPersistStorage::SaveCompleted method.
HRESULT Save(
IStorage *pStgSave, //Pointer to storage object
BOOL fSameAsLoad //Indicates whether the specified storage
//object is the current one
);
This parameter is set to FALSE when performing a Save As or Save A Copy To operation or when performing a full save. In the latter case, this method saves to a temporary file, deletes the original file, and renames the temporary file.
This parameter is set to TRUE to perform a full save in a low-memory situation or to perform a fast incremental save in which only the dirty components are saved.
This method saves an object, and any nested objects it contains, into the specified storage. It also places the object into NoScribble mode. Thus, the object cannot write to its storage until a subsequent call to the IPersistStorage::SaveCompleted method returns the object to Normal mode.
If the storage object is the same as the one it was loaded or created from, the save operation may be able to write incremental changes to the storage object. Otherwise, a full save must be done.
This method recursively calls the IPersistStorage::Save method, the OleSave function, or the IStorage::CopyTo method to save its nested objects.
This method does not call the IStorage::Commit method. Nor does it write the CLSID to the storage object. Both of these tasks are the responsibilities of the caller.
Rather than calling IPersistStorage::Save directly, you typically call the OleSave helper function which performs the following steps:
Then, a container application performs any other operations necessary to complete the save and calls the SaveCompleted method for each object.
If an embedded object passes the IPersistStorage::Save method to its nested objects, it must receive a call to its IPersistStorage::SaveCompleted method before calling this method for its nested objects.
Windows NT: Use version 3.1 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in objidl.h.
IPersistStorage::InitNew, IPersistStorage::Load, IPersistStorage::SaveCompleted, OleSave, IStorage::Commit, IStorage::CopyTo, OleSave, WriteClassStg, WriteFmtUserTypeStg