我知道在CView中得到CDocument指针用GetDocument(),但在CDocument中该怎样取得指向CView的指针呢?

解决方案 »

  1.   

    POSITION pos = GetFirstViewPosition();
       while (pos != NULL)
       {
          CView* pView = GetNextView(pos);
          pView->UpdateWindow();
       }   
      

  2.   

    //1,先的获得文档模板//2,通过文档模板获得文档,
    //3,通过文档获得视图,
    //这是一段最小化所有窗口的代码,编历所有View希望对你有所启发:)void CImageProcessApp::OnMinimizeAll() 
    {
    POSITION pos = GetFirstDocTemplatePosition();
    CDocTemplate* pDocTempl = NULL;
    while(pos)
    {
    pDocTempl = GetNextDocTemplate(pos);
    POSITION posDoc = pDocTempl->GetFirstDocPosition();
    while(posDoc)
    {
    CDocument *pDoc = pDocTempl->GetNextDoc(posDoc);
    POSITION posView = pDoc->GetFirstViewPosition();
    while(posView)
    {
    pDoc->GetNextView(posView)->GetParent()->ShowWindow(SW_MINIMIZE);
    }
    }
    }
    }
      

  3.   

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