移植到MFC功能部件包会导致现有应用崩溃 [英] Porting to MFC feature pack leads crash to existing aplication
问题描述
大家好,
我开始将MFC功能包移植到我现有的应用程序中,以获得更好的UI支持.我进行了以下更改.
修改基类.
CWinApp to CWinAppEx
CMDIFrameWnd to CMDIFrameWndEx
CMDIChildWnd to CMDIChildWndEx
在InitInstance中添加了以下代码行
InitContextMenuManager(); InitShellManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()-> SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);
代码成功构建,但是在启动应用程序时,登录对话框出现后我就崩溃了.在调试时,我发现OnInitDialog可以正常工作.但是在oninitdialog返回之后,它给出了异常.我不知道崩溃的确切位置.
LoginDlg oDlg(strUserName, bstrLanguage,bstrDomainName); if(oDlg.DoModal() == IDOK) {.....} //OnInitDialog Code BOOL LoginDlg::OnInitDialog() { CDialog::OnInitDialog(); CoTranslateWindow(GetSafeHwnd()); ......... return true ; }
我遇到了
这样的异常
Unhandled exception at 0x7787703d in MyApp.exe: 0xC0000005: Access violation writing location 0x0000000000030ff8. Problem Event Name: APPCRASH Application Name: MyApp.exe Application Version: 5.23.0.0 Application Timestamp: 506d7f93 Fault Module Name: mfc90u.dll Fault Module Version: 9.0.30729.4967 Fault Module Timestamp: 4b6bc34c
我知道它非常抽象,但是请帮助我.
问候
BitsMax
您可以尝试激活"VS-> Debug->例外"对话框中的所有复选框
然后再次启动调试器:
还可以将您的序列与VS-Wizard生成的版本进行比较:)
在我第一次转换为Feature Pack时,我头疼很多.
我最终只是让向导生成了一个新的新框架,并将我的旧代码合并到其中.
在我看来,重要的是要理解为什么手动转换失败会导致快速升级代码如此之多,所以我可以重新开始编写代码.Hello all,
I started porting to MFC feature pack to my exiting application to get better UI support. I made following changes .
Modify the base class.
CWinApp to CWinAppExCMDIFrameWnd to CMDIFrameWndExCMDIChildWnd to CMDIChildWndEx
Added following line of code in InitInstance
InitContextMenuManager(); InitShellManager(); InitKeyboardManager(); InitTooltipManager(); CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme = TRUE; theApp.GetTooltipManager()-> SetTooltipParams(AFX_TOOLTIP_TYPE_ALL, RUNTIME_CLASS(CMFCToolTipCtrl), &ttParams);
code build successfully, but while launching the application i am getting crash just after login dialog apperes. while debugging i found OnInitDialog works fine. But after the oninitdialog returns , it gave exception .i dont know where exactly the crash happens .
LoginDlg oDlg(strUserName, bstrLanguage,bstrDomainName); if(oDlg.DoModal() == IDOK) {.....} //OnInitDialog Code BOOL LoginDlg::OnInitDialog() { CDialog::OnInitDialog(); CoTranslateWindow(GetSafeHwnd()); ......... return true ; }
i am getting exception like
Unhandled exception at 0x7787703d in MyApp.exe: 0xC0000005: Access violation writing location 0x0000000000030ff8. Problem Event Name: APPCRASH Application Name: MyApp.exe Application Version: 5.23.0.0 Application Timestamp: 506d7f93 Fault Module Name: mfc90u.dll Fault Module Version: 9.0.30729.4967 Fault Module Timestamp: 4b6bc34c
I know it is very abstract, but please help me .
Regards
BitsMax解决方案You could try to activate all check boxes in the "VS->Debug->Exceptions" dialog
and then launch the debugger again:
Compare also your sequences with their version generated by VS-Wizard for a sample :)
I went through a lot of headaches in my first conversion to the Feature Pack.
I ended up just letting the wizard generate a fresh new framework and merging my older code into it.
In my view, it was important to understand why the manual conversion was failing so much as getting the code upgraded quickly, so I could get back to writing code.
这篇关于移植到MFC功能部件包会导致现有应用崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!