解决: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 ...
随机推荐
- 使用HIBERNATE的SQL查询并将结果集自动转换成POJO
在某些场合下,我们可能想使用HIBERNATE的框架提供的SQL查询接口,但是,由于实体没有做映射,HIBERNATE不能把结果集转换成你想要的List<POJO>,本文讨论如何在这种情况 ...
- bash shell命令行选项与修传入参数处理
在编写shell程序时经常需要处理命令行参数,本文描述在bash下的命令行处理方式.选项与参数:如下命令行: ./test.sh -f config.conf -v --prefix=/home -f ...
- Note: RewriteCond规则
如果文件存在,就直接访问文件,不进行下面的RewriteRule:RewriteCond %{REQUEST_FILENAME} !-f 如果目录存在,就直接访问目录,不进行下面的RewriteRul ...
- lambda表达式对比
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...
- PHP抓取采集类snoopy介绍
PHP抓取采集类snoopy介绍 一个PHP的抓取方案 在 2011年07月04日 那天写的 已经有 10270 次阅读了 感谢 参考或原文 服务器君一共花费了14.288 ms进行了2次 ...
- 固定某一元素在某一位置 jquery
方法: $(window).scroll(function (){}) 属性: 滚动变化值 $(window).scrollTop();$(window).scrollLeft(); 需要结合的样式: ...
- <?php set_time_limit(10);
<?php include('w_fun.php'); set_time_limit(10); Fatal error: Maximum execution time of 10 seconds ...
- QTSingleApplication使用笔记
http://www.cnblogs.com/kevinzhwl/archive/2012/08/27/2658839.html QTSingleApplication,是Qt官方提供的,用于实现只启 ...
- 将ntfs分区转换为ext4分区
转自 http://blog.csdn.net/nianhongmin/article/details/27818195 将ntfs分区转换为ext4分区 分类: Linux 2014-05-31 1 ...
- CC2541连接BTool教程
一.简介 本篇介绍如何基于Smart RF(主芯片CC2541).Smart RF(主芯片CC2540).Usb Dongle,来使用软件BTool. 本篇暂时只介绍如何连接,不介绍如何使用BTool ...