我想做一个程序,左面为CFormView,右面为图形区,代码如下:BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
//创建一行两列的面板分区视图
if(!m_wndSplitter.CreateStatic(this,1,2,WS_CHILD|WS_VISIBLE))
{
TRACE("Failed to CreateStaticSplitter\n");
return FALSE;
}
//为第一个面板创建视图
//下面的CFormCommandView继承自CFormView
if(!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CFormCommandView),CSize(200,160),pContext)) {
TRACE("Failed to Create CommandView\n");
return FALSE;
}
//为第二个面板创建视图,CRenderView继承自CView
if(!m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CRenderView),CSize(200,200),pContext))
{
TRACE("Failed to Create Preview pane\n");
return FALSE;
}
return CFrameWnd::OnCreateClient(lpcs, pContext);
}编译能通过,执行时出现一个对话框(Microsoft Visual C++ Debug Library):
Debug Assertion Failed!
Program: D:\..\Debug\OLEvent.exe //OLEvent.exe为编译后的执行程序
File:viewform.cpp
Line:69for information on how your program can casue an assertion failure,see the Visual C++ documentation on asserts.(press retry to debug the application)请各位大虾指点一下,不胜感激!!!
{
// TODO: Add your specialized code here and/or call the base class
//创建一行两列的面板分区视图
if(!m_wndSplitter.CreateStatic(this,1,2,WS_CHILD|WS_VISIBLE))
{
TRACE("Failed to CreateStaticSplitter\n");
return FALSE;
}
//为第一个面板创建视图
//下面的CFormCommandView继承自CFormView
if(!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CFormCommandView),CSize(200,160),pContext)) {
TRACE("Failed to Create CommandView\n");
return FALSE;
}
//为第二个面板创建视图,CRenderView继承自CView
if(!m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CRenderView),CSize(200,200),pContext))
{
TRACE("Failed to Create Preview pane\n");
return FALSE;
}
return CFrameWnd::OnCreateClient(lpcs, pContext);
}编译能通过,执行时出现一个对话框(Microsoft Visual C++ Debug Library):
Debug Assertion Failed!
Program: D:\..\Debug\OLEvent.exe //OLEvent.exe为编译后的执行程序
File:viewform.cpp
Line:69for information on how your program can casue an assertion failure,see the Visual C++ documentation on asserts.(press retry to debug the application)请各位大虾指点一下,不胜感激!!!
if (!_AfxCheckDialogTemplate(m_lpszTemplateName, TRUE))
{
ASSERT(FALSE); // invalid dialog template name
PostNcDestroy(); // cleanup if Create fails too soon
return FALSE;
}应该是你其他地方的问题,源码显示,invalid dialog template name