BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
// TODO: Add your specialized code here and/or call the base class
if (m_spliterWnd.CreateStatic(this,1,2)==NULL)
return FALSE;
   
BOOL bb=m_spliterWnd.CreateView(0,0,RUNTIME_CLASS(CLeftView),CSize(100,100) ,pContext);
    
    BOOL aa=m_spliterWnd.CreateView(0,1,RUNTIME_CLASS(CRightView),CSize(100,100) ,pContext);

return TRUE;
}
aa 总是等于0,若将CRightView改为他的基类,则aa=1,为何,如何修改??

解决方案 »

  1.   

    看看CRightView的代码,也许是CRightView初始化之类的有问题
      

  2.   

    BOOL aa=m_spliterWnd.CreateView(0,1,RUNTIME_CLASS(CRightView),CSize(100,100) ,pContext);改成BOOL aa=m_spliterWnd.CreateView(1,0,RUNTIME_CLASS(CRightView),CSize(100,100) ,pContext);
      

  3.   

    用getlasterror检查是什么错误。
      

  4.   

    Step by Step
    Step 1.首先Ctrl+W添加两个新类
    CMyListView : CListView
    CMyTreeView : CTreeViewStep 2.然后Project->Add to Project->Components and Controls
    进入Visual C++ Components文件夹
    选择添加Splitter Bar
    一路OK就OK3.你会发现在CMainFrame中发现增加了一下函数
    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
    删除其中所有的内容
    添加以下代码
    m_wndSplitter.CreateStatic(this ,1, 2);
    m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CTreeView), CSize(202, 0), pContext);
    m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CListView), CSize(0, 0), pContext);return TRUE;Step 4.加入CTreeView,CListView的头文件即可Step 5.如有任何问题,可以发信给我
    [email protected]
    我尽力帮你解决---------------------------
                      May you succeed!
                        -------------------------------
    如何写三分窗口
    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
    {
    // CG: The following block was added by the Splitter Bar component. m_wndSplitter.CreateStatic(this ,1, 2);
    m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CTestView), CSize(202, 0), pContext);
    m_wndSplitter2.CreateStatic(&m_wndSplitter, 2, 1, WS_CHILD|WS_VISIBLE, m_wndSplitter.IdFromRowCol(0,1));
    m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CTestView), CSize(0, 150), pContext);
    m_wndSplitter2.CreateView(1, 0, RUNTIME_CLASS(CTestView), CSize(0, 0), pContext);

    return TRUE;
    }