Saves any changes made to a property storage object to the parent storage object.
HRESULT Commit(
DWORD grfCommitFlags //Flags specifying conditions for the commit
);
This method supports the standard return value E_UNEXPECTED, as well as the following:
As in IStorage::Commit, ensures that any changes made to a property storage object are reflected in the parent storage.
In direct mode in the compound file implementation, this call causes any changes currently buffered up in memory to be flushed to the underlying property stream. In the compound file implementation for non-simple property sets, IStorage::Commit is also called on the underlying substorage object with the passed grfCommitFlags parameter.
In transacted mode, this method causes the changes to be permanently reflected in the persistent image of the storage object. The changes that are committed must have been made to this property set since it was opened or since the last commit on this opening of the property set. One could think of the action of committing as publishing the changes that this level currently knows about one more layer outwards. Of course, this is still subject to any outer level transaction that may be present on the object in which this property set is contained. Write permission must be specified when the property set is opened (through IPropertySetStorage) on the property set opening for the commit operation to succeed.
If the commit operation fails for any reason, the state of the property storage object is as it was before the commit.
This call has no effect on existing storage- or stream-valued properties opened from this property storage, but it does commit them.
Valid values for the grfCommitFlags parameter are as follows:
Value | Meaning |
---|---|
STGC_DEFAULT | Commit per the usual transaction semantics. Last writer wins. This flag may not be specified with other flag values. |
STGC_ONLYIFCURRENT | Commit the changes only if the current persistent contents of the property set are the ones on which the changes about to be committed are based. That is, do not commit changes if the contents of the property set have been changed by a commit from another opening of the property set. The error STG_E_NOTCURRENT is returned if the commit does not succeed for this reason. |
STGC_OVERWRITE | Only useful when committing a transaction which has no further outer nesting level of transactioning, though legal in all cases. Indicates that the caller is willing to take some risk of data corruption at the expense of a decreased usage of disk on the destination volume. This flag is potentially useful in low disk space scenarios, though should be used only with caution. |
Windows NT: Use version 4.0 or later.
Windows: Use Windows 95 or later. Available as a redistributable for Windows 95.
Windows CE: Unsupported.
Header: Declared in objidl.h.
IPropertyStorage::ReadMultiple, IStorage::Commit