关于MFC中用m_WndSplitter.GetPane方法来获到视图指针出错
<P>我的CMainFrame类中OnCreateClient函数如下写的<BR>BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) <BR>{<BR> if (!m_wndSplitter.CreateStatic(this, 1, 3,WS_CHILD | WS_VISIBLE))<BR> {<BR> TRACE("Failed to CreateStaticSplitter\n");<BR> return FALSE;<BR> }</P><P> // First splitter pane<BR> if (!m_wndSplitter.CreateView(0, 0,<BR> RUNTIME_CLASS(FormLeft), CSize(110,160), pContext))<BR> {<BR> TRACE("Failed to create command view pane\n");<BR> return FALSE;<BR> }</P>
<P> // Second splitter pane<BR> if (!m_wndSplitter.CreateView(0, 1,<BR> RUNTIME_CLASS(CsitView), CSize(510,200), pContext))<BR> {<BR> TRACE("Failed to create preview pane\n");<BR> return FALSE;<BR> }<BR> if (!m_wndSplitter.CreateView(0, 2,<BR> RUNTIME_CLASS(FormRight), CSize(150,160), pContext))<BR> {<BR> TRACE("Failed to create command view pane\n");<BR> return FALSE;<BR> }<BR> return TRUE;<BR>}<BR>然后在一另一个类中如下来调用视图类指针<BR>CsitView* FormLeft::FormLeft_getview(void)<BR>{<BR> CMainFrame *pframe=(CMainFrame*)AfxGetApp()->m_pMainWnd;<BR> CsitView *pview=(CsitView*)pframe->m_wndSplitter.GetPane(0,1);<BR> return pview;<BR>}<BR>CsitView是我的视图类<BR>但运行的结果是,报错信息为:<BR>Debug Assertion Failed!<BR>File:winsplit.cpp<BR>Line:344<BR>For information on how your program can cause an assertion failure,see the VC documentation on asserts</P> [em16]
页:
[1]
