Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize


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

Return Value

A pointer to the single CWinApp object for the application.


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

See Also

MFC Macros and Globals

© 2015 Microsoft