vc获取特殊路径
原创
©著作权归作者所有:来自51CTO博客作者ives404的原创作品,请联系作者获取转载授权,否则将追究法律责任
//c:/windows/system32
CString FileUtil::GetSystem32Dir() {
CString strPath;
::GetSystemDirectory(strPath.GetBuffer(_MAX_PATH), _MAX_PATH);
strPath.ReleaseBuffer();
MessageBox(NULL,LPCTSTR(strPath), "SysPath", MB_OK);
return strPath;
}
//C:\Program Files
CString FileUtil::GetProgarmeFile() {
CString sPath;
SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, 0, sPath.GetBuffer(MAX_PATH));
sPath.ReleaseBuffer();
return sPath;
}
//<user name>\Local Settings\Applicaiton Data (non roaming)
CString FileUtil::GetAPPLocal() {
CString sPath;
SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, sPath.GetBuffer(MAX_PATH));
sPath.ReleaseBuffer();
return sPath;
}
留待后查,同时方便他人