Use the
GetModuleFileName Function (Windows)[
^] to get the full pathname of the application executable, then use the
PathRemoveFileSpec Function (Windows)[
^] to remove the trailing file name and backslash from that path, as shown below:
TCHAR szFilename[MAX_PATH];
VERIFY(GetModuleFileName(NULL, szFilename, MAX_PATH) < MAX_PATH);
VERIFY(PathRemoveFileSpec(szFilename));