关于CFrameWnd中获得CView的指针CFrameWnd* pFrame;
可以确定pFrame有且仅有1个View.
当由于有多个Frame,所以初始情况下pFrame不存在ActiveView.
pFrame->GetActiveView()==NULL
当点击对应的View后可以获得正确的ActiveView.
pFrame->GetActiveView()!=NULL
初始情况,在pFrame中如何获得所有View?

解决方案 »

  1.   

    GetFirstViewPos
    GetNextViewPos
    不知是谁的成员函数?
      

  2.   

    没有用CDocument!我的frame是Create出来的。其中一个参数
    用RUNTIME_CLASS(CMyView),没有调用CreatView,因此创建过程中也没有View的指针
      

  3.   

    CFrameWnd::GetActiveDocument
    CDocument::GetFirstViewPosition
    CDocument::GetNextView //To get the first view in the list of views:POSITION pos = GetFirstViewPosition();
    CView* pFirstView = GetNextView( pos );
    // This example uses CDocument::GetFirstViewPosition
    // and GetNextView to repaint each view.
    void CMyDoc::OnRepaintAllViews()
    {
       POSITION pos = GetFirstViewPosition();
       while (pos != NULL)
       {
          CView* pView = GetNextView(pos);
          pView->UpdateWindow();
       }   
    }
      

  4.   

    Create后调用CFrameWnd::InitialUpdateFrame(NULL,TRUE);