请问可不可以在mainframe(多文档)中访问文档中的数据。 
我是在mainframe中处理菜单事件。 将
CVIDoc *pDoc = (CVIDoc*)GetActiveDocument();
ASSERT_VALID(pDoc);
写在菜单事件中,结果得到的pDoc为NULL。
不知道怎样做可以在mainframe可以访问到文档中的数据。
请大侠指点,多谢!!

解决方案 »

  1.   

    CDocument *pDoc = GetActiveFrame()->GetActiveDocument();
      

  2.   

    CMDIFrameWnd *pFrame = 
                 (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;// Get the active MDI child window.
    CMDIChildWnd *pChild = 
                 (CMDIChildWnd *) pFrame->GetActiveFrame();// or CMDIChildWnd *pChild = pFrame->MDIGetActive();// Get the active view attached to the active MDI child
    // window.
    CMyView *pView = (CMyView *) pChild->GetActiveView();CMyDoc *pDoc = (CMyDoc*)(pView->GetDocument());