Share via


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;

必要条件

ヘッダー: afxwin.h

参照

関連項目

CDocument クラス

階層図

CDocTemplate クラス