If your application is an OLE server, call this function to retrieve a pointer to the active main window of the application instead of directly referring to the m_pMainWnd member of the application object.
virtual CWnd * GetMainWnd( );
This function returns a pointer to one of two types of windows. If your thread is part of an OLE server and has an object that is in-place active inside an active container, this function returns the CWinApp::m_pActiveWnd data member of the CWinThread object.
If there is no object that is in-place active within a container or your application is not an OLE server, this function returns the m_pMainWnd data member of your thread object.
For user-interface threads, this is equivalent to directly referring to the m_pActiveWnd member of your application object.
If your application is not an OLE server, then calling this function is equivalent to directly referring to the m_pMainWnd member of your application object.
Override this function to modify the default behavior.