AfxGetApp
Visual Studio 2010
Updated: June 2010
The pointer returned by this function can be used to access application information such as the main message-dispatch code or the topmost window.
CWinApp* AFXAPI AfxGetApp( );