这样建立模板 后面
初始化窗口
m_bFileOpenFirst=TRUE;
CMainFrame* pMainFrame = new CMainFrame;//CEB666
mp_doc=new CEB666Doc;
//mp_doc->OnNewDocument();
mp_doc->SetTitle("HQT EB666 radio program software");
CCreateContext context;
context.m_pCurrentDoc=mp_doc;
context.m_pNewViewClass=NULL;//RUNTIME_CLASS(CEB666View);
context.m_pNewDocTemplate=NULL;//pDocTemplate;
context.m_pLastView=NULL;
context.m_pCurrentFrame=NULL;//pTreeFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME,WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE,NULL, &context ))
return FALSE;
m_pMainWnd = pMainFrame;
第一个窗口
context.m_pCurrentDoc=mp_doc; //that's the way I avoid to create new document every time I open a new view
context.m_pNewViewClass=RUNTIME_CLASS(CChView);
context.m_pNewDocTemplate=pDocTemplate1;
context.m_pLastView=(((CMainFrame *)m_pMainWnd)->GetActiveFrame() ? ((CMainFrame *)m_pMainWnd)->GetActiveFrame()->GetActiveView() : NULL);
context.m_pCurrentFrame=((CMainFrame *)m_pMainWnd)->GetActiveFrame();
pChFrame->LoadFrame(IDR_MAINFRAME1,WS_OVERLAPPEDWINDOW ,m_pMainWnd, &context );
pChFrame->MoveWindow(0,0,725,500);
pChFrame->SetWindowText(g_LoadString("IDS_CHANNEL"));
pChFrame->InitialUpdateFrame(mp_doc,TRUE);
第二个窗口
if(pFuncFrame!=NULL)
{
pFuncFrame->MDIActivate();
return;
}
pFuncFrame = new CChildFrame();
CCreateContext context;
context.m_pCurrentDoc=mp_doc; //that's the way I avoid to create new document every time I open a new view
context.m_pNewViewClass=RUNTIME_CLASS(CFucView);
context.m_pNewDocTemplate=pDocTemplate2;
context.m_pLastView=(((CMainFrame *)m_pMainWnd)->GetActiveFrame() ? ((CMainFrame *)m_pMainWnd)->GetActiveFrame()->GetActiveView() : NULL);
context.m_pCurrentFrame=((CMainFrame *)m_pMainWnd)->GetActiveFrame();
if (!pFuncFrame->LoadFrame(IDR_MAINFRAME1,WS_OVERLAPPEDWINDOW ,m_pMainWnd, &context ))return;
pFuncFrame->MoveWindow(20,30,695,520);
pFuncFrame->SetWindowText(g_LoadString("IDS_FUNCTION"));
pFuncFrame->InitialUpdateFrame(mp_doc,TRUE);