共用方式為


CWinApp::m_pszExeName

包含應用程式的可執行檔的名稱,但不含副檔名。

LPCTSTR m_pszExeName;

備註

不同於 m_pszAppName,名稱不能包含空白。 m_pszExeName 是型別 **const char***的公用變數。

注意事項注意事項

如果您將值指派給 m_pszExeName,在堆積上必須動態配置它。CWinApp 解構函式呼叫 free() 與這個指標。您想要使用許多 _tcsdup() 執行階段程式庫函式會配置。此外,請釋放記憶體與目前指標在指派新值以前。例如:

//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

請參閱

參考

CWinApp 類別

階層架構圖