CSIDL (Shlobj.h) - Win32 apps | Microsoft Learn
举例:
#define CSIDL_PROGRAMS 0x0002 // Start Menu\Programs
我想知道开始菜单程序栏的文件夹位置:
#include <QString>
#include <tchar.h>
#include <Windows.h>
#include <ShlObj.h>
QString GetCSIDLPath(int path)
{
std::wstring wsValue = L"";
wchar_t wzLacalAppData[MAX_PATH] = { 0 };
if (SUCCEEDED(SHGetFolderPathW(NULL, path, NULL, SHGFP_TYPE_CURRENT, wzLacalAppData)))
{
wsValue = wzLacalAppData;
}
QString str = QString::fromStdWString(wsValue);
return str;
}
调用函数(返回值即目标):
GetCSIDLPath(CSIDL_PROGRAMS);
参考:
SHGetSpecialFolderPath 与 SHGetFolderPathW 的使用_shgetspecialfolderpathw-CSDN博客