部分代码如下:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
//************* 将窗体切分成一行两列 ***************
if ( m_wndSplitter.CreateStatic(this,1,2) == NULL )
return FALSE;
下面的被我屏蔽掉了,
编译没问题,执行时出现错误终止程序,提示winsplit.cpp出错,请教是什么错误。
提供本人得代码,供你参考:
if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to create splitter window\n");
return FALSE;
}
// Get the client rect first for calc left pane size
CRect rect;
GetClientRect(&rect);
// create the left tree view first.
if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CBOXView), CSize(rect.Width()/3, 0), pContext))
{
TRACE0("Failed to create left pane view\n");
return FALSE;
}
// The right pane is a frame which and contain several different views.
// The is can be set to active or non-active
if (!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CUserView), CSize(0, 0), pContext))
{
TRACE0("Failed to create right pane frame\n");
return FALSE;
}
// Set the active view
SetActiveView((CView*) m_wndSplitter.GetPane(0, 0));
return TRUE;
只执行m_wndSplitter.CreateStatic(this,1,2) ,程序当然会出错了,把屏蔽去掉,用楼上的代码试试。