IPersistFile::IsDirty
Checks an object for changes since it was last saved to its current file.
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 objects that have not yet been saved. The
dirty flag for an object is conditionally cleared in the
IPersistFile::Save method.
Notes to Callers
OLE does not call
IPersistFile::IsDirty. Typically, applications do not either.
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
An object with no contained objects simply checks its dirty flag to return the
appropriate result.
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.
The container object can clear its dirty flag whenever it is saved, as long as
the file saved to is the current working file 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::IsDirty
- 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