CDocument::GetDocTemplate

呼叫這個函式的指標這個文件類型的文件樣板。

CDocTemplate* GetDocTemplate( ) const;

傳回值

對文件範本的指標資料型別或 NULL ,如果文件沒有被文件樣板處理。

範例

// This example accesses the doc template object to construct
// a default document name such as SHEET.XLS, where "sheet"
// is the base document name and ".xls" is the file extension
// for the document type.
CString strDefaultDocName, strBaseName, strExt;
CDocTemplate* pDocTemplate = GetDocTemplate();
if (!pDocTemplate->GetDocString(strBaseName, CDocTemplate::docName)
   || !pDocTemplate->GetDocString(strExt, CDocTemplate::filterExt))
{
   AfxThrowUserException(); // These doc template strings will
      // be available if you created the application using AppWizard
      // and specified the file extension as an option for
      // the document class produced by AppWizard.
}
strDefaultDocName = strBaseName + strExt;

需求

Header: afxwin.h

請參閱

參考

CDocument 類別

階層架構圖

CDocTemplate 類別