我使用 Shell 来获取控制面板
代码:
procedure TForm1.FormCreate(Sender: TObject);
var
psfDeskTop: IShellFolder;
psfWork: IShellFolder;
pidworkDir: PITEMIDLIST;
pidChild: PITEMIDLIST;
pEnumList: IEnumIDList;
celtFetched: ULONG;
FileInfo: SHFILEINFOW;
begin
Memo1.Clear;
SHGetDesktopFolder(psfDeskTop);
//control panel
SHGetSpecialFolderLocation(0, CSIDL_CONTROLS, pidworkDir);
psfDeskTop.BindToObject(pidworkDir, nil, IID_IShellFolder, psfWork);
psfWork.EnumObjects(0, SHCONTF_NONFOLDERS or SHCONTF_FOLDERS or SHCONTF_INCLUDEHIDDEN, pEnumList);
while pEnumList.Next(1, pidChild, celtFetched) = 0 do
begin
SHGetFileInfo(LPCTSTR(pidChild), 0, FileInfo, SizeOf(FileInfo), SHGFI_PIDL
or SHGFI_TYPENAME or SHGFI_DISPLAYNAME or SHGFI_USEFILEATTRIBUTES);
Memo1.Lines.Add(FileInfo.szDisplayName + ' +');
end;
end;
它无法获取FileInfo.szDisplayName
,我只是 ' +'
用来制作 Memo1 显示。为什么无法获取控制面板名称?