mfc里AfxGetAPP()与AfxGetThread()的区别
2012-11-26 21:19
337 查看
mfc里AfxGetAPP()与AfxGetThread()的区别
AfxGetThread()返回的是当前界面线程对象的指针。AfxGetApp()返回的是应用程序对象的指针,如果该应用程序(或进程)只有一个界面线程在运行,那么这两者返回的都是一个全局的应用程序对象指针,这个全局的应用程序对象就是MFC应用框架所默认的theApp对象。也就是说当每次使用AppWizard生成一个SDI或MDI应用程序时,AppWizard都会添加CYourApp theApp这条语句,AfxGetApp()返回的就是这个theApp的地址。
AfxGetApp是取前theApp的指针。
AfxGetThread是指得当前线程指针,如果在多线程时调用AfxGetThread返回的与AfxGetApp并不一定相同。
相关文章推荐
- MFC里AfxGetThread()与AfxGetAPP()的区别
- MFC从哪启动,从哪结束--关于AfxWinMain,AfxGetApp,AfxGetThread
- AfxGetMain()和AfxGetApp()->m_pMainFrame的区别
- 多线程中AfxGetApp()->m_pMainWnd和AfxGetMainWnd() 的区别?
- 探索MFC全局函数-AfxGetApp()
- MFC的模块状态:AfxGetApp()和AFX_MANAGE_STATE()
- MFC的模块状态:从AfxGetApp()和AFX_MANAGE_STATE()看MFC的模块状态
- 探索MFC全局函数-AfxGetApp()
- MFC的模块状态:从AfxGetApp()和AFX_MANAGE_STATE()看MFC的模块状态
- MFC的模块状态:从AfxGetApp()和AFX_MANAGE_STATE()看MFC的模块状态
- MFC全局函数开局——AfxGetApp解剖
- mfc中的 afxgetapp 和 afxgetmainwnd 以及生命全局变量
- afxgetapp->afxmainwnd 与afxgetmainwnd的区别 /线程中调用afxgetmainwnd的问题
- 对 “句柄” “指针” 有下面的描述(AfxGetMainWnd GetSafeHwnd() AfxGetAppName() AfxGetThread)
- MFC的模块状态:从AfxGetApp()和AFX_MANAGE_STATE()看MFC的模块状态
- MFC的模块状态:从AfxGetApp()和AFX_MANAGE_STATE()看MFC的模块状态
- AfxGetApp()->m_pMainWnd和AfxGetMainWnd() 的区别
- MFC的模块状态:从AfxGetApp()和AFX_MANAGE_STATE()看MFC的模块状态
- AfxGetApp()->GetMainWnd()和AfxGetMainWnd()的区别
- AfxGetApp()->GetMainWnd与AfxGetMainWnd的区别