string GetExePath(void) { char szFilePath[MAX_PATH + 1]={0}; GetModuleFileNameA(NULL, szFilePath, MAX_PATH); (strrchr(szFilePath, '\'))[0] = 0; // 删除文件名,只获得路径 string path = szFilePath; return path; }
https://blog.csdn.net/jaken99/article/details/78231872