This topic has not yet been rated - Rate this topic

AfxGetApp

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( ); 

A pointer to the single CWinApp object for the application.

If this method returns NULL, it might indicate that the application’s main window has not been fully initialized yet. It might also indicate a problem.


// Print the application's executable filename.
TRACE(_T("Executable filename = %s\n"), AfxGetApp()->m_pszExeName);


Header: afxwin.h

Date

History

Reason

June 2010

Added note re NULL pointer.

Customer feedback.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ