学习型 ASP/PHP/ASP.NET 主机 30元/年全能 ASP/PHP/ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付
发新话题
打印

关于MFC中用m_WndSplitter.GetPane方法来获到视图指针出错

关于MFC中用m_WndSplitter.GetPane方法来获到视图指针出错

我的CMainFrame类中OnCreateClient函数如下写的
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_wndSplitter.CreateStatic(this, 1, 3,WS_CHILD | WS_VISIBLE))
{
TRACE("Failed to CreateStaticSplitter\n");
return FALSE;
}

// First splitter pane
if (!m_wndSplitter.CreateView(0, 0,
RUNTIME_CLASS(FormLeft), CSize(110,160), pContext))
{
TRACE("Failed to create command view pane\n");
return FALSE;
}

// Second splitter pane
if (!m_wndSplitter.CreateView(0, 1,
RUNTIME_CLASS(CsitView), CSize(510,200), pContext))
{
TRACE("Failed to create preview pane\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(0, 2,
RUNTIME_CLASS(FormRight), CSize(150,160), pContext))
{
TRACE("Failed to create command view pane\n");
return FALSE;
}
return TRUE;
}
然后在一另一个类中如下来调用视图类指针
CsitView* FormLeft::FormLeft_getview(void)
{
CMainFrame *pframe=(CMainFrame*)AfxGetApp()->m_pMainWnd;
CsitView *pview=(CsitView*)pframe->m_wndSplitter.GetPane(0,1);
return pview;
}
CsitView是我的视图类
但运行的结果是,报错信息为:
Debug Assertion Failed!
File:winsplit.cpp
Line:344
For information on how your program can cause an assertion failure,see the VC documentation on asserts

TOP

海鸽 is My Lover!!

TOP

发新话题