Share via


CDataRecoveryHandler Class

The CDataRecoveryHandler autosaves documents and restores them if an application unexpectedly exits.

class CDataRecoveryHandler : public CObject

Members

Constructors

CDataRecoveryHandler::CDataRecoveryHandler

Constructs a CDataRecoveryHandler object.

Methods

CDataRecoveryHandler::AutosaveAllDocumentInfo

Autosaves each file registered with the CDataRecoveryHandler class.

CDataRecoveryHandler::AutosaveDocumentInfo

Autosaves the specified document.

CDataRecoveryHandler::CreateDocumentInfo

Adds a document to the list of open documents.

CDataRecoveryHandler::DeleteAllAutosavedFiles

Deletes all the current autosaved files.

CDataRecoveryHandler::DeleteAutosavedFile

Deletes the specified autosaved file.

CDataRecoveryHandler::GenerateAutosaveFileName

Generates the name for an autosave file associated with the supplied document file name.

CDataRecoveryHandler::GetAutosaveInterval

Returns the interval between autosave tries.

CDataRecoveryHandler::GetAutosavePath

Returns the path of the autosaved files.

CDataRecoveryHandler::GetDocumentListName

Retrieves the document name from a CDocument object.

CDataRecoveryHandler::GetNormalDocumentTitle

Retrieves the normal title for the specified document.

CDataRecoveryHandler::GetRecoveredDocumentTitle

Creates and returns the title for the recovered document.

CDataRecoveryHandler::GetRestartIdentifier

Retrieves the unique restart identifier for the application.

CDataRecoveryHandler::GetSaveDocumentInfoOnIdle

Indicates whether the CDataRecoveryHandler performs an autosave on the current idle loop.

CDataRecoveryHandler::GetShutdownByRestartManager

Indicates whether the restart manager caused the application to exit.

CDataRecoveryHandler::Initialize

Initializes the CDataRecoveryHandler.

CDataRecoveryHandler::QueryRestoreAutosavedDocuments

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.

CDataRecoveryHandler::ReadOpenDocumentList

Loads the open document list from the registry.

CDataRecoveryHandler::RemoveDocumentInfo

Removes the supplied document from the open document list.

CDataRecoveryHandler::ReopenPreviousDocuments

Opens the previously open documents.

CDataRecoveryHandler::RestoreAutosavedDocuments

Restores the autosaved documents based on user input.

CDataRecoveryHandler::SaveOpenDocumentList

Saves the current list of open documents to the Windows registry.

CDataRecoveryHandler::SetAutosaveInterval

Sets the time between autosave cycles in milliseconds.

CDataRecoveryHandler::SetAutosavePath

Sets the directory where autosaved files are stored.

CDataRecoveryHandler::SetRestartIdentifier

Sets the unique restart identifier for this instance of the CDataRecoveryHandler.

CDataRecoveryHandler::SetSaveDocumentInfoOnIdle

Sets whether the CDataRecoveryHandler saves the open document information to the Windows registry during the current idle cycle.

CDataRecoveryHandler::SetShutdownByRestartManager

Sets whether the previous exit of the application was caused by the restart manager.

CDataRecoveryHandler::UpdateDocumentInfo

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

Reference

Hierarchy Chart

CObject Class

Other Resources

MFC Classes