Share via


CDocument::DeleteContents

virtualvoidDeleteContents();

Remarks

Called by the framework to delete the document’s data without destroying the CDocument object itself. It is called just before the document is to be destroyed. It is also called to ensure that a document is empty before it is reused. This is particularly important for an SDI application, which uses only one document; the document is reused whenever the user creates or opens another document. Call this function to implement an “Edit Clear All” or similar command that deletes all of the document’s data. The default implementation of this function does nothing. Override this function to delete the data in your document.

Example

// This example is the handler for an Edit Clear All command.

void CMyDoc::OnEditClearAll()
{
   DeleteContents();
   UpdateAllViews(NULL);  
}

void CMyDoc::DeleteContents()
{
   // Re-initialize document data here.

}

CDocument OverviewClass MembersHierarchy Chart

See Also   CDocument::OnCloseDocument, CDocument::OnNewDocument, CDocument::OnOpenDocument