讲解 VC 中的变量 m_pMainWnd
来源:互联网 发布:媒体的力量 知乎 编辑:程序博客网 时间:2024/05/17 20:32
CWnd* m_pMainWnd;
// main window (usually same AfxGetApp()->m_pMainWnd)
...
m_pMainWnd = &dlg;
Use this data member to store a pointer to your thread’s main window object. The Microsoft Foundation Class Library will automatically terminate your thread when the window referred to by m_pMainWnd is closed. If this thread is the primary thread for an application, the application will also be terminated. If this data member is NULL, the main window for the application’s CWinApp object will be used to determine when to terminate the thread. m_pMainWnd is a public variable of type CWnd*.
Typically, you set this member variable when you override InitInstance. In a worker thread, the value of this data member is inherited from its parent thread.
用该成员变量去存储你的线程主窗口对象。当和m_pMainWnd 相关的窗口被关闭后,MFC会自动终止你的线程。如果该线程是应用程序主线程,程序也将会被终止。如果该数据成员为NULL,应用程序CWinApp对象的主窗口将用来决定什么时候去终止线程。m_pMainWnd是一个CWnd*类型的public变量。
很明显,你需要在重载InitInstance时为m_pMainWnd赋值。在工作线程中,m_pMainWnd自动继承其父线程的值。
=============================
m_pMainWnd is a public variable of type CWnd*.
系统自动生成的主窗口句柄.
------------------------------------------------------------
CChatRoomDlg *dlg;
给CChatRoomDlg类实例化一个对象指针dlg
m_pMainWnd = dlg;
m_是代表成员变量,p代表指针,Wnd带代表窗口,而Main是指针的名字,翻译是主要的意思。
m_pMainWnd就是CChatRoomDlg类的一个成员变量,他是一个的指针,从字面上看,应该指向主窗口。用第一句声明的指针给他赋值。那么*dlg就应该是创建的的主窗口的指针。
- 讲解 VC 中的变量 m_pMainWnd
- 主窗口变量 m_pMainWnd
- m_pMainWnd
- vc中的变量命名规范
- Shell 中的局部变量,环境变量讲解
- VC内联汇编,引用程序中的变量
- 关于m_pMainWnd
- AfxGetApp()->m_pMainWnd
- CWinThread::m_pMainWnd
- CWinThread::m_pMainWnd
- MFC - m_pMainWnd
- MFC - m_pMainWnd
- VC++变量
- vc++讲解内容
- vc++HOOK详细讲解
- vc++HOOK详细讲解
- #3变量实战讲解#
- scala讲解---变量,函数
- new
- SQL SERVER 2005 简介
- SOCkET编程 难点及要点
- Download
- VS2008中捕获内存泄露
- 讲解 VC 中的变量 m_pMainWnd
- 网络爬虫设计——URL去重存储库设计
- flex分页-
- Quick Start
- 传智播客——让WEB程序紧凑之监听器
- 虚拟网络软件 hamachi
- 为什么unix/linux/ubuntu比windows高级(国外专家解答)
- 从Larbin看互联网爬虫设计
- 给软件装后门