Document 를 공유하는 Frame 윈도우 생성하기
CWinApp * pApp = AfxGetApp(); POSITION pos = pApp->m_pDocManager->GetFirstDocTemplatePosition(); CDocTemplate * pDocTemplate = pApp->m_pDocManager->GetNextDocTemplate(pos); CDocument * pDocument = GetDocument(); CFrameWnd * pwndFrame = (CFrameWnd *)RUNTIME_CLASS(CFrameWnd)->CreateObject(); ASSERT(pwndFrame != NULL); CCreateContext context; context.m_pCurrentFrame = NULL; context.m_pCurrentDoc = pDocument; context.m_pNewViewClass = RUNTIME_CLASS(CEditView); context.m_pNewDocTemplate = pDocTemplate; if( pwndFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, &context) == FALSE) { return; } pDocTemplate->SetDefaultTitle(pDocument); pDocTemplate->InitialUpdateFrame(pwndFrame, pDocument, TRUE); |