我首先新建了一个单文档,
然后从CsplitterWnd继承一个子类CMySplitter
-------------------------------------------------
class CMySplitter : public CSplitterWnd
{
// Construction
public:
CMySplitter();
    DECLARE_DYNCREATE(CMySplitter)
// Attributes
public:// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMySplitter)
//}}AFX_VIRTUAL// Implementation
public:
virtual ~CMySplitter(); // Generated message map functions
protected:
//{{AFX_MSG(CMySplitter)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
--------------------------------------------------------
然后在CMainFrame类重载OnCreateClient()
---------------------------------------------------------
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{
// TODO: Add your specialized code here and/or call the base class
    
BOOL bResult=m_wndsplitter.CreateStatic(this,1,2);
ASSERT(bResult);
      m_wndsplitter.CreateView(0,0,RUNTIME_CLASS(CView1),CSize(200,200),pContext);
  m_wndsplitter.CreateView(0,1,RUNTIME_CLASS(CView2),CSize(600,600),pContext);
return bResult;
}
---------------------------------------------------------------------------
CMainFrame类
protected:  // control bar embedded members
CStatusBar  m_wndStatusBar;
CToolBar    m_wndToolBar;
    CMySplitter  m_wndsplitter;
头文件:====================
#include "stdafx.h"
#include "MapQQ.h"#include "MainFrm.h"
#include "MySplitter.h"
#include "View1.h"
#include "View2.h"
================================================
编译后错误
apQQ.cpp
e:\workspace\mfc\mapqq\mainfrm.h(45) : error C2146: syntax error : missing ';' before identifier 'm_wndsplitter'
e:\workspace\mfc\mapqq\mainfrm.h(45) : error C2501: 'CMySplitter' : missing storage-class or type specifiers
e:\workspace\mfc\mapqq\mainfrm.h(45) : error C2501: 'm_wndsplitter' : missing storage-class or type specifiers
MainFrm.cpp
e:\workspace\mfc\mapqq\mainfrm.h(45) : error C2146: syntax error : missing ';' before identifier 'm_wndsplitter'
e:\workspace\mfc\mapqq\mainfrm.h(45) : error C2501: 'CMySplitter' : missing storage-class or type specifiers
e:\workspace\mfc\mapqq\mainfrm.h(45) : error C2501: 'm_wndsplitter' : missing storage-class or type specifiers
E:\Workspace\MFC\MapQQ\MainFrm.cpp(117) : error C2065: 'm_wndsplitter' : undeclared identifier
E:\Workspace\MFC\MapQQ\MainFrm.cpp(117) : error C2228: left of '.CreateStatic' must have class/struct/union type
E:\Workspace\MFC\MapQQ\MainFrm.cpp(119) : error C2228: left of '.CreateView' must have class/struct/union type
E:\Workspace\MFC\MapQQ\MainFrm.cpp(120) : error C2228: left of '.CreateView' must have class/struct/union type
========================================================
如果用
CSplitterWnd m_wndsplitter;
则可正常编译;
请问是哪的错误,我刚学不久。
还有如何禁制分割条的移动。
谢谢