类似的还有: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的更多相关文章

  1. 解决 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 ...

  2. [日常] 解决PHP Warning: Module 'mysqli' already loaded in Unknown on line 0

    解决PHP Warning: Module 'mysqli' already loaded in Unknown on line 0 原因:是PHP有两种方式添加扩展模块,一种是直接编译进了PHP,另 ...

  3. zencart后台管理中选项名称和选项内容和属性控制页面出错解决办法 WARNING: An Error occurred, please refresh the page and try again

    后台管理中选项名称和选项内容和属性控制出现以下错误的解决办法WARNING: An Error occurred, please refresh the page and try again zen ...

  4. 【转】解决警告 warning: directory not found for option

    转:http://blog.sina.com.cn/s/blog_6f72ff900101es6x.html 解决方法: 选择项目名称----->Targets----->Build Se ...

  5. 解决警告 warning: directory not found for option

    解决方法: 选择项目名称----->Targets----->Build Settings----->Search Paths----->Library Search Path ...

  6. 解决编译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 ...

  7. 解决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 ...

  8. 解决:[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的问题一直存在,今 ...

  9. 解决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 ...

随机推荐

  1. 在Windows下部署安装hexo

    由于hexo的文档里并没有一步步详细写出过程的细节,在Windows下又更麻烦,所以就很容易入坑. 安装 安装github for windows,msysgit 安装包: https://githu ...

  2. MySQL 使用explain查看执行计划

    使用explain查看执行计划, 下面是针对这两条语句进行分析,其查询结果是一样的. EXPLAIN select n.id,n.title from info n inner join info_t ...

  3. 解决Ecshop因为动态ip问题登录后台自动退出

    解决Ecshop因为动态ip问题登录后台自动退出 PHP  铁匠  2年前 (2013-07-21)  1130℃  0评论 修改lib_base.php文件real_ip()函数,添加以下代码即可解 ...

  4. GUN485项目的总结

    1.DMA中配置要放在串口的配置后面. 2.DMA有3种中断方式:传输完成.传输一半.传输错误 3.如果要用DMA容易造成串口数据还没发完就把485的控制脚拉低导致数据没发完.解决办法是DMA发送完成 ...

  5. 七 mybatis的延迟加载

    1       延迟加载 1.1     什么是延迟加载 resultMap可以实现高级映射(使用association.collection实现一对一及一对多映射),association.coll ...

  6. qTip2 精致的jQuery提示信息插件

    qTip2 精致的jQuery提示信息插件    出处:http://www.cnblogs.com/lwme/archive/2012/02/16/qtip2-jquery-plugin.html ...

  7. UBUNTU 14.04 安装 OPENCV 2.4.9

    1.  从OpenCV.org 下载源代码 opencv-2.4.9.zip 2. 解压到准备好的目录 unzip opencv-2.4.9.zip 3. 进入源码目录,创建release目录 cd ...

  8. phpCAS::handleLogoutRequests()关于java端项目登出而php端项目检测不到的测试

    首先,假如你有做过cas,再假如你的cas里面有php项目,这个时候要让php项目拥有cas的sso功能,你需要改造你的项目,由于各人的项目不同,但是原理差不多,都是通过从cas服务器获取sessio ...

  9. random and password 在Linux下生成crypt加密密码的方法,shell 生成指定范围随机数与随机字符串

    openssl rand -hex n (n is number of characters) LANG=c < /dev/urandom tr -dc _A-Z-a-z-0-9 | head ...

  10. C/C++ 中长度为0的数组

    参考文献:http://blog.csdn.net/zhaqiwen/article/details/7904515 近日在看项目中的框架代码时,发现了了一个奇特的语法:长度为0的数组例如 uint8 ...