1. 程式人生 > 其它 >MFC之CSingleDocTemplate建構函式

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; ...... }