CString ctest1dlg :: getRunning (void)
{
Char exec (MAX_PATH];
GetModuleFileName (NULL, EXEPATH, MAX_PATH); // A array represents the EXE file path
CString DIR;
Dir.Format ("% s", execPath); // string represents the EXE file path
DIR = Dir.Left (Dir.reverseFind ('//')); // Delete the EXE file name
Return Dir;
}
Return value example
D: / pro / ex1 / debug
[No '/' after the directory]