VS2010,MFCEditBrowseControl堆崩溃 [英] VS2010, MFCEditBrowseControl heap crash

查看:223
本文介绍了VS2010,MFCEditBrowseControl堆崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的对话框,其中包含新的MFC浏览器编辑控件.使用成员变量向导将该控件链接到"CMFCEditBrowseCtrl m_edit".向导生成的映射看起来不错.

I have a simple dialog that contains the new MFC browse edit control. The control was linked to 'CMFCEditBrowseCtrl m_edit' using the member variable wizard. The wizard generated mappings seem fine.

第一次运行时,编辑控件会填充中文字符或问号,然后在首次按下浏览按钮时或选择文件后崩溃.

On first run, the edit control is populated with chinese type characters or sometimes question marks, and then crashes either when the browse button is first pressed, or as soon as a file has been selected.

该应用程序因堆损坏失败而崩溃.

The app crashes with a heap corruption failure.

当我创建一个新的测试项目并执行相同的步骤时,所有工作都很好-仅当我尝试在具有大约VS2003-> VS2005->升级历史的较大的较旧项目中实施浏览编辑控件时,才会出现此问题. VS2008-> VS2010.

When I create a new test project and perform the same steps, all works fine - the problem only occurs when I try to implement the browse edit control in a larger older project with an upgrade history of approx VS2003 -> VS2005 -> VS2008 -> VS2010.

代码没有什么奇怪的,我怀疑它可能与项目清单或其他一些init指令/冲突有关.我已经从测试项目中复制并粘贴了CWinApp :: InitInstance代码,希望它可以揭示某些内容,但是行为仍然相同.

There is nothing odd about the code, and I suspect it might have something to do with the project manifest or some other init instruction / conflict. I have copied and pasted the CWinApp::InitInstance code from the test project hoping that that might reveal something, but the behaviour is still the same.

有什么想法吗?

推荐答案

经过进一步的研究,我正要放弃依赖此控件的代码,我注意到一种解决方法是将CMFCBrowseEditCtrl而不是直接放置在对话框中框,放置一个CEdit控件!然后在头文件中,用CMFCBrowseEditCtrl替换控件的成员验证类型CEdit.我发现此方法有效,因为我也使用此控件找到了一些旧代码,效果很好 也为我工作.> Blockquote

After some further investigation, just about I was abandoning my code relying on this control, I noticed that one workaround may be to instead of placing CMFCBrowseEditCtrl directly in the dialog box, place a CEdit control! And then in the header file, replace the member veriable type CEdit for the control with CMFCBrowseEditCtrl. I discovered this worked as I found some old code also using this control, which worked well worked for me as well.> Blockquote

这篇关于VS2010,MFCEditBrowseControl堆崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆