CDataRecoveryHandler Class
The CDataRecoveryHandler autosaves documents and restores them if an application unexpectedly exits.
class CDataRecoveryHandler : public CObject
Members
Constructors
Constructs a CDataRecoveryHandler object. |
Methods
Autosaves each file registered with the CDataRecoveryHandler class. |
|
Autosaves the specified document. |
|
Adds a document to the list of open documents. |
|
Deletes all the current autosaved files. |
|
Deletes the specified autosaved file. |
|
Generates the name for an autosave file associated with the supplied document file name. |
|
Returns the interval between autosave tries. |
|
Returns the path of the autosaved files. |
|
Retrieves the document name from a CDocument object. |
|
Retrieves the normal title for the specified document. |
|
Creates and returns the title for the recovered document. |
|
Retrieves the unique restart identifier for the application. |
|
Indicates whether the CDataRecoveryHandler performs an autosave on the current idle loop. |
|
Indicates whether the restart manager caused the application to exit. |
|
Initializes the CDataRecoveryHandler. |
|
Displays a dialog box to the user for each document that the CDataRecoveryHandler autosaved. The dialog box determines whether the user wants to restore the autosaved document. |
|
Loads the open document list from the registry. |
|
Removes the supplied document from the open document list. |
|
Opens the previously open documents. |
|
Restores the autosaved documents based on user input. |
|
Saves the current list of open documents to the Windows registry. |
|
Sets the time between autosave cycles in milliseconds. |
|
Sets the directory where autosaved files are stored. |
|
Sets the unique restart identifier for this instance of the CDataRecoveryHandler. |
|
Sets whether the CDataRecoveryHandler saves the open document information to the Windows registry during the current idle cycle. |
|
Sets whether the previous exit of the application was caused by the restart manager. |
|
Updates the information for a document because the user saved it. |
Data Members
m_bRestoringPreviousOpenDocs |
Indicates whether the data recovery handler reopens previously open documents. |
m_bSaveDocumentInfoOnIdle |
Indicates whether the data recovery handler autosaves documents on the next idle loop. |
m_bShutdownByRestartManager |
Indicates whether the restart manager causes the application to exit. |
m_dwRestartManagerSupportFlags |
Flags that indicate what support the restart manager provides for the application. |
m_lstAutosavesToDelete |
A list of autosaved files that were not deleted when the original documents were closed. When the application exits, the restart manager retries deleting the files. |
m_mapDocNameToAutosaveName |
A map of the document names to the autosaved file names. |
m_mapDocNameToDocumentPtr |
A map of the document names to the CDocument pointers. |
m_mapDocNameToRestoreBool |
A map of the document names to a Boolean parameter that indicates whether to restore the autosaved document. |
m_mapDocumentPtrToDocName |
A map of the CDocument pointers to the document names. |
m_mapDocumentPtrToDocTitle |
A map of the CDocument pointers to the document titles. These titles are used for saving files. |
m_nAutosaveInterval |
Time in milliseconds between autosaves. |
m_nTimerID |
The identifier for the autosave timer. |
m_strAutosavePath |
The location where the autosaved documents are stored. |
m_strRestartIdentifier |
The string representation of a GUID for the restart manager. |
Remarks
The restart manager uses the CDataRecoveryHandler class to keep track of all open documents and to autosave them as necessary. To enable autosave, use the CDataRecoveryHandler::SetSaveDocumentInfoOnIdle method. This method directs the CDataRecoveryHandler to perform an autosave on the next idle loop. The restart manager calls SetSaveDocumentInfoOnIdle when the CDataRecoveryHandler should perform an autosave.
All of the methods of the CDataRecoveryHandler class are virtual. Override the methods in this class to create your own custom data recovery handler. Unless you create your own data recovery handler or restart manager, do not instantiate a CDataRecoveryHandler. The CWinApp Class creates a CDataRecoveryHandler object as it is required.
Before you can use a CDataRecoveryHandler object, you must call CDataRecoveryHandler::Initialize.
Because the CDataRecoveryHandler class is closely connected to the restart manager, CDataRecoveryHandler depends on the global parameter m_dwRestartManagerSupportFlags. This parameter determines what permissions the restart manager has and how it interacts with your application. To incorporate the restart manager into an existing application, you have to assign m_dwRestartManagerSupportFlags the appropriate value in the constructor of your main application. For more information about how to use the restart manager, see How to: Add Restart Manager Support.
Requirements
Header: afxdatarecovery.h
See Also
Tasks
How to: Add Restart Manager Support