共用方式為


CWinApp::AddDocTemplate

Call this member function to add a document template to the list of available document templates that the application maintains.

void AddDocTemplate(
   CDocTemplate* pTemplate 
);

Parameters

  • pTemplate
    A pointer to the CDocTemplate to be added.

Remarks

You should add all document templates to an application before you call RegisterShellFileTypes.

Example

   // The following code is produced by the Application Wizard when you
   // choose the MDI (multiple document interface) option.
    CMultiDocTemplate* pDocTemplate;
    pDocTemplate = new CMultiDocTemplate(IDR_MYTYPE,
        RUNTIME_CLASS(CMyDoc),
        RUNTIME_CLASS(CChildFrame), // custom MDI child frame
        RUNTIME_CLASS(CMyView));
    if (!pDocTemplate)
        return FALSE;
    AddDocTemplate(pDocTemplate);

Requirements

Header: afxwin.h

See Also

Reference

CWinApp Class

Hierarchy Chart

CWinApp::RegisterShellFileTypes

CMultiDocTemplate Class

CSingleDocTemplate Class

Other Resources

CWinApp Members