请问:我一个SDI中将窗口切分为三列,第三列对应的是一个基于CFrameWnd的类,我现在想在同一个工程中的一个自建类里取这个切分窗口的指针,请问应该怎么取?拜托各位大虾,答对了马上给分!!!

解决方案 »

  1.   

    调用CSplitterWnd::GetPane( int row, int col );
    其它见MSDN
      

  2.   

    在用GetActiveView()函数就能得到你的当前的视图类指针啊
    当前哪一个是active,得到的就是哪一个的指针
      

  3.   

    sorry,我以为你用的是视图切换。所以用GetActiveView()
    In355Hz说得很对
      

  4.   

    用m_SplitterWnd.getpane(...)
    再看msdn上的例子,viewex,它很好的,很全
      

  5.   

    基于以上的取得指针的方法都会出错。我试过了用GetPane()和GetFirstViewPosition()结合GetNextView()来取得指针。但是结果指针没有出错,但是用指针来调用一些函数时就会出错了。最好能给个代码。资源浏览器的风格的。
      

  6.   

    在主窗口中切分窗口的代码如下,我现在要取得的就是CRightPaneFrame的指针,不知道怎么取。
    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
    {
    VERIFY(m_wndSplitter.CreateStatic(this, 1, 3)); VERIFY(m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CLeftPaneView),CSize(100,100), pContext));
    VERIFY(m_wndSplitter.CreateView(0, 2, RUNTIME_CLASS(CRightPaneFrame),CSize(400,200), pContext));

    m_wndSplitter.RecalcLayout(); return true;

    return CFrameWnd::OnCreateClient(lpcs, pContext);
    }
      

  7.   

    CRightPaneFrame *pRight = (CRightPaneFrame*)GetParent();
    CRTView* pView = ((CRTView*)pRight->m_wndSplitter.GetPane(0, 2));这样不对,我想取的pRight怎么也取不过来,CRTView是未被切分的窗口的视。
      

  8.   

    To djhdu(小火花) 
    你能不能说得明白一点呀?我还是不太明白,不好意思。
      

  9.   

    CMainFrame *pMainFrame=(CMainFrame*)AfxGetMainWnd();
      //the user_defined function in the class CMainFrame
      //to get address of the object of m_wndSplitter
    //该函数是你在CMainFrame中添加的辅助函数,返回分隔条的引用即可。
      CSplitterWnd *pSplitter=pMainFrame->GetSplitterWnd();
      CFrameWnd *pWnd=(CFrameWnd*pSplitter->GetPane(0,2);
    //use the pWnd;
      

  10.   

    谢谢psusong(我心飞扬) ,问题已经解决
    马上给分!!