Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining


Use this data member to store a pointer to your thread's main window object.

CWnd* m_pMainWnd;

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.

Header: afxwin.h

Community Additions

© 2015 Microsoft