MFC CDocument 및 연결된 CView가 MDI 응용 프로그램에서 열려 있습니다. 문서를 열린 상태로 유지하면서 뷰 (및 연관된 프레임)를 분리하고 닫고 싶습니다. MFC 코드를보고 어떻게 동작하는지 살펴보면 CDocument :: OnCloseDocument();문서를 열어 두면서 MFC CVIEW를 닫는 방법
// destroy all frames viewing this document
// the last destroy may destroy us
BOOL bAutoDelete = m_bAutoDelete;
m_bAutoDelete = FALSE; // don't destroy document while closing views
while (!m_viewList.IsEmpty())
{
// get frame attached to the view
CView* pView = (CView*)m_viewList.GetHead();
ASSERT_VALID(pView);
CFrameWnd* pFrame = pView->EnsureParentFrame();
// and close it
PreCloseFrame(pFrame);
pFrame->DestroyWindow();
// will destroy the view as well
}
m_bAutoDelete = bAutoDelete;
나는 CDocument :: RemoveView와 함께 사용할 수 있다고 생각합니다. MFC 소스를 들어 올리는 것보다이 방법에 접근하는 더 좋은 방법이 있을까요?이 접근법으로 인해 다른 문제 나 부작용이 생길 수 있습니까? 이 프로젝트는 VS2010 C++입니다.