1
2
3
4
// 获取当前进程的当前目录
char path[MAX_PATH];
memset(0, path, MAX_PATH);
GetCurrentDirectory(MAX_PATH,curr_all_path);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 取得程序运行目录
TCHAR szPathName[MAX_PATH];
memset(szPathName, 0, MAX_PATH);
if (0 == GetModuleFileName(NULL, szPathName, MAX_PATH))
{
return _T("");
}
CString rValue;
rValue = szPathName;
for (int i = rValue.GetLength(); i > 0; --i)
{
if ('\\' == rValue[i-1])
{
rValue = rValue.Left(i);
break;
}
}
return rValue;