DoModal occmgr.cpp(195)

本文解决了一个在Visual Studio 2008中移植对话框导致的内存泄漏问题,具体表现为对话框无法正常弹出且出现RichEdit控件相关的错误提示。通过逐步排查并最终在App::InitInstance()函数中加入AfxInitRichEdit();解决了该问题。

环境:vs2008,xp sp3

问题:拷贝一个对话框到一个新工程后,使用DoModal打开对话框,不弹出对话框,并在输出窗口有以下内容:

Detected memory leaks!
Dumping objects ->
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\occmgr.cpp(195) : {479} normal block at 0x00E32B68, 32 bytes long.
 Data: <                > ED 03 00 00 00 00 00 00 02 00 00 00 00 00 00 00
f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\occmgr.cpp(181) : {478} normal block at 0x00E32B18, 20 bytes long.
 Data: <                > FF FF FF FF 00 00 00 00 00 00 00 00 00 00 00 00
Object dump complete.

 

解决:一个个把对话框上的控件给删除,结果删掉一个richedit控件后,发现好了,认为是此问题,在原来的工程的搜索“richedit”,发现在

App::InitInstance()的函数里有AfxInitRichEdit();,新工程无,新工程添上后,好了

 

发生错误了已启动生成… 1>------ 已启动生成: 项目: ImageSystem, 配置: Debug Win32 ------ 1>ImageSystemDlg.cpp 1>C:\Users\John\source\repos\ImageSystem\ImageSystem\ImageSystemDlg.cpp(132,26): error C2065: “gt”: 未声明的标识符 1>C:\Users\John\source\repos\ImageSystem\ImageSystem\ImageSystemDlg.cpp(132,28): error C2429: 语言功能 "if/switch 中的 init-statement" 需要编译器标志 "/std:c++17" 1>C:\Users\John\source\repos\ImageSystem\ImageSystem\ImageSystemDlg.cpp(141,23): error C2065: “gt”: 未声明的标识符 1>C:\Users\John\source\repos\ImageSystem\ImageSystem\ImageSystemDlg.cpp(141,57): error C2660: “SetStretchBltMode”: 函数不接受 1 个参数 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\wingdi.h(4584,25): message : 参见“SetStretchBltMode”的声明 1>C:\Users\John\source\repos\ImageSystem\ImageSystem\ImageSystemDlg.cpp(142,26): error C2065: “gt”: 未声明的标识符 1>C:\Users\John\source\repos\ImageSystem\ImageSystem\ImageSystemDlg.cpp(142,28): error C2143: 语法错误: 缺少“)(在“;”的前面) 1>C:\Users\John\source\repos\ImageSystem\ImageSystem\ImageSystemDlg.cpp(142,28): error C2661: “ATL::CImage::StretchBlt”: 没有重载函数接受 1 个参数 1>C:\Users\John\source\repos\ImageSystem\ImageSystem\ImageSystemDlg.cpp(142,30): error C2065: “m_hDC”: 未声明的标识符 1>C:\Users\John\source\repos\ImageSystem\ImageSystem\ImageSystemDlg.cpp(142,54): error C2059: 语法错误:“)1>C:\Users\John\source\repos\ImageSystem\ImageSystem\ImageSystemDlg.cpp(143,9): error C2065: “gt”: 未声明的标识符 1>C:\Users\John\source\repos\ImageSystem\ImageSystem\ImageSystemDlg.cpp(143,38): error C2660: “SetStretchBltMode”: 函数不接受 1 个参数 1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um\wingdi.h(4584,25): message : 参见“SetStretchBltMode”的声明 1>已完成生成项目“ImageSystem.vcxproj”的操作 - 失败。 ========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
09-04
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值