解决:AppMsg - Warning: calling DestroyWindow in CWnd::~CWnd; OnDestroy or PostNcDestroy in derived class will not be called
类似的还有:AppMsg - Warning: Destroying non-NULL m_pMainWnd(这是因为你既没有自己delete,也没有调用DestroyWindow)
首先解决第一个,直接列代码:
class SCCApp : public CWinApp class CMainWindow : public CFrameWnd BOOL SCCApp::InitInstance()
{
m_pMainWnd = new CMainWindow;
if (!::RegisterHotKey(m_pMainWnd->GetSafeHwnd(), 0x0001, NULL, VK_F1))
{
::MessageBox(NULL, _T("注册F1热键失败!请关闭热键冲突的程序并重启本程序!"),
_T("错误"), MB_ICONERROR);
delete m_pMainWnd;
return FALSE;
}
m_pMainWnd->ShowWindow(m_nCmdShow);
m_pMainWnd->UpdateWindow();
return TRUE;
}
12行,你直接delete,但该window不会收到WM_DESTROY and WM_NCDESTROY消息,所以无法正确的销毁,替换为:
m_pMainWnd->DestroyWindow();
不需要你手动写delete,这是因为虽然CWnd的PostNcDestroy不会调用delete this,但CFrameWnd的PostNcDestroy会调用delete this。你调用完之后m_pMainWnd会变为NULL,你可以在下面加如下代码验证:
if (m_pMainWnd == NULL)
std::ofstream os("NULL");
最开始我在m_pMainWnd->DestroyWindow()后面用delete m_pMainWnd来验证发现没有报错,就是因为delete NULL没有任何效果。
解决:AppMsg - Warning: calling DestroyWindow in CWnd::~CWnd; OnDestroy or PostNcDestroy in derived class will not be called的更多相关文章
- 解决 dpkg: warning: files list file for package 'x' missing 问题
参考: dpkg: warning: files list file for package 'x' missing 解决 dpkg: warning: files list file for pac ...
- [日常] 解决PHP Warning: Module 'mysqli' already loaded in Unknown on line 0
解决PHP Warning: Module 'mysqli' already loaded in Unknown on line 0 原因:是PHP有两种方式添加扩展模块,一种是直接编译进了PHP,另 ...
- zencart后台管理中选项名称和选项内容和属性控制页面出错解决办法 WARNING: An Error occurred, please refresh the page and try again
后台管理中选项名称和选项内容和属性控制出现以下错误的解决办法WARNING: An Error occurred, please refresh the page and try again zen ...
- 【转】解决警告 warning: directory not found for option
转:http://blog.sina.com.cn/s/blog_6f72ff900101es6x.html 解决方法: 选择项目名称----->Targets----->Build Se ...
- 解决警告 warning: directory not found for option
解决方法: 选择项目名称----->Targets----->Build Settings----->Search Paths----->Library Search Path ...
- 解决编译warning:warning: ‘MeteringUnit::voltage_gain_’ will be initialized after [-Wreorder]
问题: 环境:ubuntu 12.04,g++版本4.6.3,编译目标文件时出现warnings: u1204@u1204-zhw:~/hwsvn/2sw/4prj_mips/UCP_rt5350/s ...
- 解决perl: warning: Setting locale failed.
在Ubuntu Server 12.04上执行apt-get install命令时,报如下warning 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...
- 解决:[WARNING] fpm_children_bury(), line 215: child 2736 (pool default) exited on signal 15 SIGTERM after 59.588363 seconds from start
试用Nginx + PHP FastCGI 做WEB服务器,运行了几个月的时间,烦恼的是经常碰到Nginx 502 Bad Gateway 这个问题. 参考了很多修改办法,这个502的问题一直存在,今 ...
- 解决configure: WARNING: You will need re2c 0.13.4 or later
我在安装rabbitmq php扩展的时候发现 configure: WARNING: You will need re2c 0.13.4 or later if you want to regene ...
随机推荐
- GC-垃圾回收
代:0代,1代,2代: 所谓第几代,指经历过GC回收的次数. 回收算法: 1.确认需要检查的代. 在分配新对象时, 如果第0代已满,则进行检查:如果第1代已满,则进行检查:第2代同理: 如第0代没有足 ...
- 在Windows下部署安装hexo
由于hexo的文档里并没有一步步详细写出过程的细节,在Windows下又更麻烦,所以就很容易入坑. 安装 安装github for windows,msysgit 安装包: https://githu ...
- laravel md5+salt 密码
laravel 默认用的登录密码加密方式是: $password = Hash::make('password'); 修改密码加密方式为: $password = md5('password'.'sa ...
- von Neumann architecture
COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION 3.1 COMPUTER COMPONEN ...
- 样条曲线的Fortran程序
subroutine basis_function_b_val ( tdata, tval, yval ) ! !******************************************* ...
- Bluetooth L2CAP介绍
目录 1. 通用操作 1. L2CAP Channel 2. 设备间操作 3. 层间操作 4. 操作模式 2. 数据包格式(Data Packet Format) 1. B-Frame 2. G-Fr ...
- Qt from Linux to Windows target
45down voteaccepted Just use M cross environment (MXE). It takes the pain out of the whole process: ...
- ImageX用来做Windows OEM部署
https://technet.microsoft.com/en-us/library/cc722145(v=ws.10).aspx http://download.csdn.net/user/phc ...
- 应中DOS中断显示字符串(摘自《汇编语言》王爽)
data segment s1 db 'Good,better,best,$' s2 db 'Never let it rest,$' s3 db 'Till good is better,$' s4 ...
- JQuery通过$(xxx...)返回对象
var JQ = function () { return new JQ.prototype.init(); }; JQ.prototype.init = function () { }; JQ.pr ...