1 利用向导生成MDI框架
2 如果不想默认打开默然的子窗体,则在:App类中InitInstance() 中修改以下:
/*
pDocTemplate = new CMultiDocTemplate(
IDR_OAIMTYPE,
RUNTIME_CLASS(COAIMDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(COAIMView));
*/
pDocTemplate = new CMultiDocTemplate(
IDR_OAIMTYPE,
NULL, //为NUll
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(COAIMView));
以下代码注释:
// 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;
3 如果想打开自己做的窗体做为默认的子窗体:
新增一个窗体,按 ctrl+W 新建类,选择基类是: CFormView.设计完窗体的界面后,千万切记:改变窗体的Style为Child
4 想直接打开,则加入一些代码到 InitInstance() 的最后:
CChildFrame *pView=new CChildFrame;
if (pView == NULL) return false;
CCreateContext context;
context.m_pNewViewClass=RUNTIME_CLASS(C*****); //为刚才建立类的名称
//创建
if(!pView->LoadFrame(IDR_OAIMTYPE,WS_MAXIMIZE,pMainFrame,&context))
return false;
pView->InitialUpdateFrame(NULL,true); //真正创建
5 如果想打开 Html 窗体,步骤同上,不同之处: 1 默认类为CHtmlView 2 窗体上不能有任何控件