获得应用程序根目录

来源:互联网 发布:淘宝打折软件开发接口 编辑:程序博客网 时间:2024/06/08 18:47


CString GetAppPath()
{//获取应用程序根目录
TCHAR modulePath[MAX_PATH];
GetModuleFileName(NULL, modulePath, MAX_PATH);/////////////////NULL参数为获得该exe本身的绝对路径
CString strModulePath(modulePath);
strModulePath = strModulePath.Left(strModulePath.ReverseFind(_T('\\')));//去处文件名,走到该目录下并返回
return strModulePath;
}
原创粉丝点击