正文

MDI,SDI创建过程中的一点不同2007-08-31 12:51:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/qiutao/29010.html

分享到:

CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate(  IDR_MDISQUTYPE,  RUNTIME_CLASS(CSquaresDoc),  RUNTIME_CLASS(CChildFrame), // custom MDI child frame  RUNTIME_CLASS(CSquaresView)); AddDocTemplate(pDocTemplate);  // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame->LoadFrame(IDR_MAINFRAME))  return FALSE; m_pMainWnd = pMainFrame; 。。。。。。。。   // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo))  return FALSE;  // The main window has been initialized, so show and update it. pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); 上面为MDI,下面为SDI CSingleDocTemplate* pDocTemplate; pDocTemplate = new CSingleDocTemplate(  IDR_MAINFRAME,  RUNTIME_CLASS(CSquaresDoc),  RUNTIME_CLASS(CMainFrame),       // main SDI frame window  RUNTIME_CLASS(CSquaresView)); AddDocTemplate(pDocTemplate); 。。。。。。。。。。  // Dispatch commands specified on the command line if (!ProcessShellCommand(cmdInfo))  return FALSE; // The main window has been initialized, so show and update it. pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); 主要是在生产文档模板对象时RUNTIME_CLASS(CChildFrame), // custom MDI child frameVS  RUNTIME_CLASS(CMainFrame),       // main SDI frame windowMDI传递的是childframe,而SDI传递的mainframe,因此MDI的ProcessShellCommand创建的是ChildFrame而SDI创建的MainFrame,所以MDI中就多出了 // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame->LoadFrame(IDR_MAINFRAME))  return FALSE; m_pMainWnd = pMainFrame; 必须自己创建MainFrame.

阅读(3738) | 评论(1)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

loading...
您需要登录后才能评论,请 登录 或者 注册