CDocument::DeleteContents

调用由框架删除文档中的数据,而不会销毁 CDocument 对象。

virtual void DeleteContents( );

备注

才会销毁之前,它调用文档。 也称为确保文档为空,则重用之前它。 这对于SDI应用程序尤其重要,只使用一个文档;重用文档,只要用户创建或打开其他文档。 调用此函数可实现“清除所有编辑器”或删除所有文档中的数据的类似的命令。 此函数的默认实现不执行任何操作。 重写此函数删除在文档中的数据。

示例

// This example is the handler for an Edit Clear All command.
void CExampleDoc::OnEditClearAll()
{
   DeleteContents();
   UpdateAllViews(NULL);   
}

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

要求

Header: afxwin.h

请参见

参考

CDocument选件类

层次结构图

CDocument::OnCloseDocument

CDocument::OnNewDocument

CDocument::OnOpenDocument