其他分享
首页 > 其他分享> > vc获取特殊路径

vc获取特殊路径

作者:互联网

//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;
}


标签:vc,MAX,路径,获取,sPath,CString,PATH,NULL,strPath
来源: https://www.cnblogs.com/ives/p/15242107.html