AfxGetApp 

CWinApp* AfxGetApp( );

Return Value

A pointer to the single CWinApp object for the application.

Remarks

The pointer returned by this function can be used to access application information such as the main message-dispatch code or the topmost window.