MFC分割窗口出错
分割窗口的代码:BOOLCMainFrame::OnCreateClient(LPCREATESTRUCTlpcs,CCreateContext*pContext){//...
分割窗口的代码:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: 在此添加专用代码和/或调用基类
CRect rect;
GetClientRect(&rect);
m_wndSplitter.CreateStatic(this, 1, 2);
m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftPaneView),
CSize(180, rect.Height()), pContext);
m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CRightPaneView),
CSize(rect.Width()-180, rect.Height()), pContext);
return TRUE;
}
运行时出错,似乎是错在RUNTIME_CLASS这里,CLeftPaneView是通过类向导添加的继承自CTreeCtrl,CRightPaneView继承自CListCtrl,经过调试错在这里:ASSERT(pWnd->m_hWnd != NULL),CLeftPaneView类和CRightPaneView类都是通过类向导添加的,没经过任何改动,我该如何解决这个错误 展开
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: 在此添加专用代码和/或调用基类
CRect rect;
GetClientRect(&rect);
m_wndSplitter.CreateStatic(this, 1, 2);
m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftPaneView),
CSize(180, rect.Height()), pContext);
m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CRightPaneView),
CSize(rect.Width()-180, rect.Height()), pContext);
return TRUE;
}
运行时出错,似乎是错在RUNTIME_CLASS这里,CLeftPaneView是通过类向导添加的继承自CTreeCtrl,CRightPaneView继承自CListCtrl,经过调试错在这里:ASSERT(pWnd->m_hWnd != NULL),CLeftPaneView类和CRightPaneView类都是通过类向导添加的,没经过任何改动,我该如何解决这个错误 展开
展开全部
不知道你的VS的版本。坦尘
下面的内容来自MSDN对于VS2005的。数悄
http://msdn.microsoft.com/zh-cn/library/5t513e2c(v=VS.80).aspx
告诫说不要调用此函数。
API是功薯信渣能,但实现功能的时机一定要合适。
Never call this function.
The default implementation of this function creates a CView object from the information provided in pContext, if possible.
Override this function to override values passed in the CCreateContext object or to change the way controls in the main client area of the frame window are created. The CCreateContext members you can override are described in the CCreateContext class.
。
下面的内容来自MSDN对于VS2005的。数悄
http://msdn.microsoft.com/zh-cn/library/5t513e2c(v=VS.80).aspx
告诫说不要调用此函数。
API是功薯信渣能,但实现功能的时机一定要合适。
Never call this function.
The default implementation of this function creates a CView object from the information provided in pContext, if possible.
Override this function to override values passed in the CCreateContext object or to change the way controls in the main client area of the frame window are created. The CCreateContext members you can override are described in the CCreateContext class.
。
追问
呵呵,谢谢你,我知道问题所在了,CRightPaneView和CLeftPaneView的直接或间接基类必需是cview类
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询