获取桌面路径、应用程序常用存放数据目录

UnicodeString getDesktopDir()
{
char szBuf[MAX_PATH];
LPITEMIDLIST lpItemIdList;
SHGetSpecialFolderLocation(0, CSIDL_DESKTOPDIRECTORY, &lpItemIdList);
SHGetPathFromIDList(lpItemIdList, szBuf);
String dir = String(szBuf);
return dir;

}


UnicodeString getApplicationDataDir()
{
    char szBuf[MAX_PATH];
LPITEMIDLIST lpItemIdList;
SHGetSpecialFolderLocation(0, CSIDL_APPDATA, &lpItemIdList);
SHGetPathFromIDList(lpItemIdList, szBuf);
String dir = String(szBuf);
return dir;
}

你可能感兴趣的:(获取桌面路径、应用程序常用存放数据目录)