AfxGetApp()->m_pMainWnd和AfxGetMainWnd()
来源:互联网 发布:每日生产报表软件 编辑:程序博客网 时间:2024/05/16 06:12
今天在解决一个bug时关注到了这两个看上去貌似一样的东西:AfxGetApp()->m_pMainWnd和AfxGetMainWnd()。平时不用多线程时,都是随便用,用法上也没什么区别,也没去专门的研究。当有BUG存在时,才意识到。
由于我是在多线程中使用,每次用AfxGetMainWnd来sendmessage时,都会崩溃,将AfxGetMainWnd提取出来设给一个pWnd时,调试显示的是为空。然后我换成AfxGetApp()->m_pMainWnd后,调试却显示有值!
因此这两个东西的用法还是有不一样的:
1、AfxGetApp()->m_pMainWnd在多线程中,获得的是应用程序主线程的句柄。在这个应用程序中是唯一的。
2、AfxGetMainWnd()获得的是当前线程的句柄。,在多线程的应用程序中也是不唯一的。
阅读全文
0 0
- AfxGetApp()->m_pMainWnd和AfxGetMainWnd()
- AfxGetApp()->m_pMainWnd和AfxGetMainWnd() 的区别
- AfxGetApp()->m_pMainWnd和AfxGetMainWnd() 的区别
- AfxGetApp()->m_pMainWnd和AfxGetMainWnd() 的区别
- AfxGetMainWnd与AfxGetApp->m_pMainWnd
- 多线程中AfxGetApp()->m_pMainWnd和AfxGetMainWnd() 的区别?
- 多线程中AfxGetApp()->m_pMainWnd和AfxGetMainWnd() 的区别?
- AfxGetApp和AfxGetMainWnd 用法举例
- AfxGetApp()->m_pMainWnd
- AfxGetApp()->GetMainWnd()和AfxGetMainWnd()的区别
- AfxGetApp()->GetMainWnd()和AfxGetMainWnd()的区别
- AfxGetApp->GetMainWnd()与AfxGetMainWnd
- AfxGetApp->GetMainWnd()与AfxGetMainWnd
- AfxGetApp->GetMainWnd()与AfxGetMainWnd
- AfxGetApp->GetMainWnd()与AfxGetMainWnd
- AfxGetApp->GetMainWnd()与AfxGetMainWnd
- AfxGetApp->GetMainWnd()与AfxGetMainWnd
- AfxGetMainWnd ,GetDocument ,AfxGetApp ,GetActiveDocument区别
- 学习vue的一些资源
- Fragment的setUserVisibleHint方法实现懒加载
- Exception Value: no such table: pizzas_topping
- Java 中的集合
- clipse上安装GIT插件EGit及使用
- AfxGetApp()->m_pMainWnd和AfxGetMainWnd()
- Android:读取Word文档
- JS数组对象的splice()和slice()的区别
- Ubuntu下多个版本OpenCV管理(Multiple Opencv version)
- 离散题目3
- 线程的互斥与死锁问题
- 【PMP认证考试之个人总结】第 7 章 项目质量管理
- VUE 全家桶,vue2-vue-router-vuex-axios
- less和scss对比