LeftView.h #if !defined(AFX_LEFTVIEW_H__29FDEE6F_5FDE_41BB_BFAC_28793AE50F11__INCLUDED_)
#define AFX_LEFTVIEW_H__29FDEE6F_5FDE_41BB_BFAC_28793AE50F11__INCLUDED_#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// LeftView.h : header file
///////////////////////////////////////////////////////////////////////////////
// CLeftView viewclass CLeftView : public CHtmlView
{
protected:
CLeftView();           // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CLeftView)// Attributes
public:// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CLeftView)
protected:
virtual void OnDraw(CDC* pDC);      // overridden to draw this view
virtual void OnInitialUpdate(); // called first time after construct
virtual void OnNavigateComplete2(LPCTSTR lpszURL);
//}}AFX_VIRTUAL// Implementation
protected:
virtual ~CLeftView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif // Generated message map functions
protected:
//{{AFX_MSG(CLeftView)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};///////////////////////////////////////////////////////////////////////////////{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.#endif // !defined(AFX_LEFTVIEW_H__29FDEE6F_5FDE_41BB_BFAC_28793AE50F11__INCLUDED_)
RightFrom.h#pragma once// RightFrom 窗体视图class RightFrom : public CFormView
{
DECLARE_DYNCREATE(RightFrom)protected:
RightFrom();           // 动态创建所使用的受保护的构造函数
virtual ~RightFrom();public:
enum { IDD = IDD_DIALOG1 };
#ifdef _DEBUG
virtual void AssertValid() const;
#ifndef _WIN32_WCE
virtual void Dump(CDumpContext& dc) const;
#endif
#endifprotected:
virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持 DECLARE_MESSAGE_MAP()
};MainFrm.cpp
m_splitter.CreateStatic(this, 1, 2);
m_splitter.CreateView(0,0, RUNTIME_CLASS(CLeftView), CSize(750, 0), pContext);//tag1
//m_splitter.CreateView(0,1,RUNTIME_CLASS(RightFrom),CSize(200,0),NULL);
m_splitter.CreateView(0,1, RUNTIME_CLASS(RightFrom), CSize(100, 0), pContext);// tag2
return CMDIFrameWnd::OnCreateClient(lpcs, pContext);我注释掉 tag2时运行正常,
添加tag2后弹出 Debug Assertion Failed!错误

解决方案 »

  1.   

    是不是可以这样写: m_wndSplitter = new ST_SplitterWnd();
    m_wndSplitter->Create(this,RUNTIME_CLASS(CLeftView),NULL,pContext,true);
    m_wndSplitter->Create(this,RUNTIME_CLASS(RightFrom),NULL,pContext,true);
    m_wndSplitter->SetInitialStatus();
      

  2.   

    先创建两个left,再替换到rightview。
      

  3.   

    //分割
    RECT r;
    int cur, min; ::GetWindowRect( ::GetDesktopWindow(), &r ); // create splitter window
    if( !m_wndSplitter_h.CreateStatic( this, 2, 1 ) )
    {
    return FALSE;
    } if( 
    !m_wndSplitter_h.CreateView( 1, 0, RUNTIME_CLASS( CNULLView ), CSize( 0, 0 ), pContext )
    //!m_wndSplitter_h.CreateView( 1, 0, RUNTIME_CLASS( CSnooperView ), CSize( 0, 0 ), pContext )
    )
    {
    m_wndSplitter_h.DestroyWindow();
    return FALSE;
    } if( !m_wndSplitter_v.CreateStatic( &m_wndSplitter_h, 1, 2, 
    WS_CHILD | WS_VISIBLE, 
    m_wndSplitter_h.IdFromRowCol( 0, 0 ) )
    )
    {
    return FALSE;
    } if( 
    !m_wndSplitter_v.CreateView( 0, 0, RUNTIME_CLASS( CSnooperView ), CSize( 0, r.bottom ), pContext ) ||
    //!m_wndSplitter_v.CreateView( 0, 0, RUNTIME_CLASS( CNULLView ), CSize( 0, r.bottom ), pContext ) ||
    !m_wndSplitter_v.CreateView( 0, 1, RUNTIME_CLASS( CNULLView ), CSize( 0, 0 ), pContext )
    )
    {
    m_wndSplitter_h.DestroyWindow();
    m_wndSplitter_v.DestroyWindow();
    return FALSE;
    }也看不出来有什么问题,懒得调,贴俺的代码贴上去当参考吧。
      

  4.   

    m_splitter.CreateStatic(this, 1, 2);
        m_splitter.CreateView(0,0, RUNTIME_CLASS(CLeftView), CSize(750, 0), pContext);//tag1
        //m_splitter.CreateView(0,1,RUNTIME_CLASS(RightFrom),CSize(200,0),NULL);
        m_splitter.CreateView(0,1, RUNTIME_CLASS(RightFrom), CSize(100, 0), pContext);// tag2
        return CMDIFrameWnd::OnCreateClient(lpcs, pContext);你的RightFrom关联的对话框模板是Child风格吗?另外最后return TRUE;