混合mfc对话框和mdi项目

时间:2016-02-17 11:26:04

标签: c++ tabs mfc mdi

我正在开发一个对话框和MDI混合的项目。该项目以标签对话框项目开始。后来MDI被添加到它。单击其中一个选项卡时,将调用MDI。没有单击特定选项卡,它仍然只是一个基于对话框的项目。 该项目在发布版本中运行良好。当我进行调试构建时,当我点击初始化MDI主框架和窗口的选项卡时,我遇到了崩溃。下面给出了为MID窗口创建执行的代码段。 崩溃消息是 MarkBullV3.exe中0x590C0983(msvcr120d.dll)的未处理异常:0xC000041D:在用户回调期间遇到未处理的异常。

非常感谢任何帮助。随意提出您可能遇到的任何问题。

谢谢&问候, 勒凯什

            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;

//////////////////////堆叠在/////////////////////// ////////////////

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] 

/////////////////堆叠结束/////////////////////////// //////////

1 个答案:

答案 0 :(得分:0)

你可以很容易地看到你在函数CScrollView::OnPrepareDC的第387行得到了一个ASSERT。位于C:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ VC \ atlmfc \ src \ mfc \ viewscrl.cpp

正如您可以在调试输出和源代码中读到的原因是:

错误:在绘制滚动视图之前必须调用SetScrollSizes()或SetScaleToFitSize()。