IPersistStorage::IsDirty
Indicates whether the object has changed since it was last saved to its
current storage.
HRESULT IsDirty(void);
Return Values
S_OK
The object has changed since it was last saved.
S_FALSE
The object has not changed since the last save.
Comments
This method checks whether an object has changed since it was last saved so
you can avoid losing information in the object that has not yet been saved. The
dirty flag for an object is conditionally cleared in the
IPersistFile::Save method.
For example, you could optimize a File:Save operation by calling the
IPersistStorage::IsDirty method for each component object and then calling the
IPersistStorage::Save method only for those component objects that are dirty.
Notes to Callers
You should treat any error return codes as an indication that the object has
changed. In other words, unless this method explicitly returns S_FALSE, you must
assume that the object needs to be saved.
Notes to Implementors
A container object with one or more contained objects must maintain an
internal dirty flag that reflects any one contained object being dirty. To do this,
the container object should register for data change notifications with each link
or embedding (see
IDataObject::DAdvise). Then, the container can maintain its internal dirty flag that it sets when
it receives an
IAdviseSink::OnDataChange notification. If the container does not register for data change
notifications, the
IPersistFile::IsDirty implementation must call
IPersistStorage::IsDirty for each of its contained objects to determine whether they have changed.
A component object can clear its dirty flag whenever it is saved, as long as
the storage saved to is the current working storage after the save. In other
words, the dirty flag is cleared after a successful "Save" or "Save As" operation,
but not after a "Save A Copy As . . ." operation.
See Also
IAdviseSink::OnDataChange,
IDataObject::DAdvise,
IPersistStorage::Save
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database