next is my code (debug mode run error, release no problem):
"CControlPanel" class derived from CFormView
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
m_wndSplitterFrame.CreateStatic(this, 2, 1);
m_wndSplitterFrame.CreateView(0, 0, RUNTIME_CLASS(CControlPanel), CSize(0, 180), pContext); //assert error line
m_wndSplitterSchema.CreateStatic(&m_wndSplitterFrame, 1, 2, WS_CHILD | WS_VISIBLE, m_wndSplitterFrame.IdFromRowCol(1, 0));
m_wndSplitterSchema.CreateView(0, 0, RUNTIME_CLASS(CTabView), CSize(250, 200), pContext);
m_wndSplitterData.CreateStatic(&m_wndSplitterSchema, 1, 2, WS_CHILD | WS_VISIBLE, m_wndSplitterSchema.IdFromRowCol(0, 1));
m_wndSplitterData.CreateView(0, 0, RUNTIME_CLASS(CItemsListView), CSize(700, 0), pContext);
m_wndSplitterData.CreateView(0, 1, RUNTIME_CLASS(CDetailHtmlView), CSize(0, 0), pContext);
....
}
But I commented "OnSize" is no assert error!
void CControlPanel::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
#ifndef _DEBUG
RECT rect1;
m_CountList.GetWindowRect(&rect1);
ScreenToClient(&rect1);
....
m_CountList.MoveWindow(&rect1);
....
#endif
}
Search said that adding the following code to solve.
AfxWinInit(::GetModuleHandle(NULL),NULL,::GetCommandLine(),0);
But again this error: f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\appinit.cpp
I think this approach is wrong, ask you how to solve this problem?