你自己在CMDIApp的中添加就可以了。
in .hclass CMDIApp : public CWinApp
{
......
// Member variables used to store the various
// document templates objects that we create in
// InitInstance()
CMultiDocTemplate* m_ptDrawing;
CMultiDocTemplate* m_ptCounter;
........
}in .cppBOOL CMDIApp::InitInstance()
{
.....
// Register the application's document templates. . // 'Drawing' document template
m_ptDrawing = new CMultiDocTemplate(
IDR_DRAWTYPE,
RUNTIME_CLASS(CDrawDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CDrawView));
AddDocTemplate(m_ptDrawing); // 'Counter' document template
m_ptCounter = new CMultiDocTemplate(
IDR_COUNTTYPE,
RUNTIME_CLASS(CCountDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CCountView));
AddDocTemplate(m_ptCounter);
//在上面的文档魔板的生成的过程中,可以随便使用自己喜欢的视图类、
//框架类和文档类,但是需要特别说明的是,你必须自己添加相应的各种资源
//可以使用copy 和paste的方法
//在以后可以使用上面的文档魔板指针操纵相关的对象!
.......
}
in .hclass CMDIApp : public CWinApp
{
......
// Member variables used to store the various
// document templates objects that we create in
// InitInstance()
CMultiDocTemplate* m_ptDrawing;
CMultiDocTemplate* m_ptCounter;
........
}in .cppBOOL CMDIApp::InitInstance()
{
.....
// Register the application's document templates. . // 'Drawing' document template
m_ptDrawing = new CMultiDocTemplate(
IDR_DRAWTYPE,
RUNTIME_CLASS(CDrawDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CDrawView));
AddDocTemplate(m_ptDrawing); // 'Counter' document template
m_ptCounter = new CMultiDocTemplate(
IDR_COUNTTYPE,
RUNTIME_CLASS(CCountDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CCountView));
AddDocTemplate(m_ptCounter);
//在上面的文档魔板的生成的过程中,可以随便使用自己喜欢的视图类、
//框架类和文档类,但是需要特别说明的是,你必须自己添加相应的各种资源
//可以使用copy 和paste的方法
//在以后可以使用上面的文档魔板指针操纵相关的对象!
.......
}
posDoc = pTemplate->GetFirstDocPosition();
pDoc = (CPCSimDoc *)pTemplate->GetNextDoc(posDoc);
if (pDoc == NULL) {
pDoc = (CPCSimDoc *)pTemplate->CreateNewDocument();
}
/* create a new frame */
CMDIChildWnd* pNewFrame
= (CMDIChildWnd*)(pTemplate->CreateNewFrame(pDoc, NULL));
pTemplate->InitialUpdateFrame(pNewFrame, pDoc);