I am working on a project which is a mixture of dialog and MDI. The project started as a tabbed dialog project. Later MDI was added to it. On clicking one of the tabs the MDI is invoked. Without clicking the a particular tab it remains only a dialog based project. The project works fine in release build. When I do a debug build I get a crash when I click on the tab that initializes the MDI main frame and window. Given below is the piece of code that is executed for MID window creation. The crash message is Unhandled exception at 0x590C0983 (msvcr120d.dll) in MarkBullV3.exe: 0xC000041D: An unhandled exception was encountered during a user callback.
Any help would be very much appreciated. Feel free to ask any question you may have.
Thanks & Regards, Rakesh
pDocTemplate = new CMultiDocTemplate(IDR_Test1TYPE,
RUNTIME_CLASS(CTest1Doc),
RUNTIME_CLASS(CChildFrame), //custom MDI child frame
RUNTIME_CLASS(CTest1View));
if (!pDocTemplate)
return FALSE;
AddDocTemplate(pDocTemplate);
pMainFrame = new CMainFrame;
if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME1))
{
delete pMainFrame;
return FALSE;
}
m_pMainWnd = pMainFrame;
for (i = 0; i < 16; i++)
theApp.OnFileNew();
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
pMainFrame->ShowWindow(m_nCmdShow);
pMainFrame->UpdateWindow();
totCustomPlotCount = 0;
//////////////////////Stack Below///////////////////////////////////////
msvcr120d.dll!_CrtDbgBreak() Line 87 C
msvcr120d.dll!_VCrtDbgReportA(int nRptType, void * returnAddress, const char * szFile, int nLine, const char * szModule, const char * szFormat, char * arglist) Line 290 C
msvcr120d.dll!_CrtDbgReportV(int nRptType, void * returnAddress, const char * szFile, int nLine, const char * szModule, const char * szFormat, char * arglist) Line 262 C
msvcr120d.dll!_CrtDbgReport(int nRptType, const char * szFile, int nLine, const char * szModule, const char * szFormat, ...) Line 279 C
mfc120d.dll!AfxAssertFailedLine(const char * lpszFileName, int nLine) Line 24 C++
mfc120d.dll!CScrollView::OnPrepareDC(CDC * pDC, CPrintInfo * pInfo) Line 387 C++
mfc120d.dll!CView::OnPaint() Line 185 C++
mfc120d.dll!CWnd::OnWndMsg(unsigned int message, unsigned int wParam, long lParam, long * pResult) Line 2448 C++
mfc120d.dll!CWnd::WindowProc(unsigned int message, unsigned int wParam, long lParam) Line 2094 C++
mfc120d.dll!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Line 282 C++
mfc120d.dll!AfxWndProc(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Line 435 C++
mfc120d.dll!AfxWndProcBase(HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Line 299 C++
user32.dll!744084f3() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]
[External Code]
V3.exe!V10App::InitInstance() Line 291 C++
[External Code]
V3.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, char * lpCmdLine, int nCmdShow) Line 26 C++
[External Code]
/////////////////End of Stack /////////////////////////////////////
As you can easily see you get an ASSERT at line 387 in the function CScrollView::OnPrepareDC
. Located in C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\atlmfc\src\mfc\viewscrl.cpp
And as you can read in the debug output and in the source code is the reason for this:
Error: must call SetScrollSizes() or SetScaleToFitSize() before painting scroll view.
User contributions licensed under CC BY-SA 3.0