MFC之CSingleDocTemplate构造函数

CSingleDocTemplate::CSingleDocTemplate

CSingleDocTemplate(UINT nIDResource,
CRuntimeClass* pDocClass,
CRuntimeClass* pFrameClass,
CRuntimeClass* pViewClass
);


参数:

 

 说明:

此成员函数用来构造一个CSingleDocTemplate对象。动态分配一个CSingleDocTemplate对象,并将它从你的应用程序类的InitInstance成员函数传递给CWinApp::AddDocTemplate。

BOOL CMyApp::InitInstance()
{
.......
    CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
        IDR_MAINFRAME,
        RUNTIME_CLASS(CMaterialTestDoc),
        RUNTIME_CLASS(CMainFrame),       // main SDI frame window
        RUNTIME_CLASS(CMaterialTestView));
    AddDocTemplate(pDocTemplate);

    // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);  ////解析命令行 

    // Dispatch commands specified on the command line
    if (!ProcessShellCommand(cmdInfo))
        return FALSE;
......
}

 



 

posted @ 2021-07-07 11:44  笑笑小白  阅读(319)  评论(0编辑  收藏  举报