类似的还有: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. PHP调用java的class

    PHP调用java的class   转:http://hi.baidu.com/lei0827/blog/item/28439a4e923234ced1c86a18.html PHP调用java的cl ...

  2. 【Xamarin Doc】 Introduction to Storyboards 笔记

    http://developer.xamarin.com/guides/ios/user_interface/introduction_to_storyboards/ Segues There are ...

  3. A20板子上的触摸屏设备号变化后解决

  4. 如何解决php 生成验证码图片不显示问题

    最近遇到一个问题,就是验证码在别人的电脑上可以显示,但是我自己的电脑上去不能.原因找了好久,哈哈,终于找到了!现在给大家分享一下: 程序: <?php $w = 80; //设置图片宽和高 $h ...

  5. MP20 MBO issue summary

    MP3 MBO经验,教训 改名字HGA003_PTOT_01,发现居然闪现进度条,正常情况是不会闪现进度条的,只是改个名字而已,怀疑之前用过这个名字,所以我后来改成HGA003_PTOT_03了. 先 ...

  6. epoll 应用

    /*  * test_bittube.cpp  *  *  Created on: 2015年7月13日  *      Author: ting.guit  */ #include <bind ...

  7. C 判断路径存在

    1   用   int   access(const   char   *pathname,   int   mode);   判断有没有此文件或目录 --它区别不出这是文件还是目录2   用   i ...

  8. 【】五句话搞定JavaScript作用域

    JavaScript的作用域一直以来是前端开发中比较难以理解的知识点,对于JavaScript的作用域主要记住几句话,走遍天下都不怕... 一.“JavaScript中无块级作用域” 在Java或C# ...

  9. js判断图片是否存在,并做处理

    <html> <head> <meta http-equiv="Content-Type" content="text/html; char ...

  10. 关于c语言二维数组与指针的个人理解及处理办法。

    相信大家在学习C语言时,对一维数组和指针的理解应该是自信的,但是,我在学习过程中,看到网上一些博文,发现即便是参加工作的一些专业编程人员,突然碰到二维数组和指针的问题时,也可能会遇到难以处理的诡异问题 ...