1.在CMyApp里应该是这样的:
CMultiDocTemplate* m_pDocTemplate[2];
m_pDocTemplate[0] = new CMultiDocTemplate(
IDR_TESTTYPE,
RUNTIME_CLASS(CTestDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CTestView));
AddDocTemplate(m_pDocTemplate[0]);
m_pDocTemplate[1] = new CMultiDocTemplate(
IDR_TESTTYPE1,
RUNTIME_CLASS(CTestDoc),
RUNTIME_CLASS(CTestFrm),
RUNTIME_CLASS(CTestView)
);
AddDocTemplate(m_pDocTemplate[1]);
2.启动新文档:
void CMyApp::OnNewOne()
{
// TODO: Add your command handler code here
this->m_pDocTemplate[0]->OpenDocumentFile(NULL);
}
void CMyApp::OnNewTwo()
{
// TODO: Add your command handler code here
this->m_pDocTemplate[1]->OpenDocumentFile(NULL);
}
3.
在*App::InitInstance()中的CCommandLineInfo cmdInfo;ParseCommandLine(cmdInfo);后加一句cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing;
这样就可以不让程序启动时侯自动加载新文档