19,504
社区成员
发帖
与我相关
我的任务
分享
bool GetCurrentPath(LPTSTR szPath)
{
HMODULE handle = GetModuleHandle(NULL);
DWORD dwRet = GetModuleFileName(handle, szPath, MAX_PATH);
if(0 == dwRet)
{
return false;
}
else
{
TCHAR* p = szPath;
while(*p)++p; //let p point to '\0'
while('\\' != *p)--p; // let p point to '\\'
*p = '\0'; //get the path
return true;
}
}