Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

CWinApp::m_pszExeName

Contains the name of the application's executable file without an extension.

LPCTSTR m_pszExeName;

Unlike m_pszAppName, this name cannot contain blanks. m_pszExeName is a public variable of type const char*.

Note Note

If you assign a value to m_pszExeName, it must be dynamically allocated on the heap. The CWinApp destructor calls free( ) with this pointer. You many want to use the _tcsdup( ) run-time library function to do the allocating. Also, free the memory associated with the current pointer before assigning a new value. For example:

//First free the string allocated by MFC at CWinApp startup. 
//The string is allocated before InitInstance is called.
free((void*)m_pszExeName);
//Change the name of the .EXE file. 
//The CWinApp destructor will free the memory.
m_pszExeName = _tcsdup(_T("c:\\somedir\\myapp"));

Header: afxwin.h

Show:
© 2014 Microsoft. All rights reserved.