我使用Shell获取控制面板
代码:
var
psfDeskTop: IShellFolder;
psfControl: IShellFolder;
pidControl: PITEMIDLIST;
pidChild: PITEMIDLIST;
pidAbsolute: PItemIdList;
pEnumList: IEnumIDList;
celtFetched: ULONG;
FileInfo: SHFILEINFOW;
begin
OleCheck(SHGetDesktopFolder(psfDeskTop));
OleCheck(SHGetSpecialFolderLocation(0, CSIDL_CONTROLS, pidControl));
OleCheck(psfDeskTop.BindToObject(pidControl, nil, IID_IShellFolder, psfControl));
OleCheck(psfControl.EnumObjects(0, SHCONTF_NONFOLDERS or SHCONTF_INCLUDEHIDDEN or SHCONTF_FOLDERS, pEnumList));
while pEnumList.Next(1, pidChild, celtFetched) = 0 do
begin
pidAbsolute := ILCombine(pidControl, pidChild);
SHGetFileInfo(LPCTSTR(pidAbsolute), 0, FileInfo, SizeOf(FileInfo), SHGFI_PIDL
or SHGFI_DISPLAYNAME);
Memo1.Add(FileInfo.szDisplayName);
end;
end;
它只能获得32位控制面板:BDE管理员(32位),Flash Player(32位), 我的操作系统是x64,我想知道如何获得所有(32位和64位)控制面板?
答案 0 :(得分:2)
您需要将代码编译为64位进程以查看64位控制面板项。这需要XE2或更高版本。当我在64位进程中尝试您的代码时,输出如下:
NVIDIA nView Desktop Manager Power Options Notification Area Icons Taskbar and Start Menu Credential Manager Default Programs RemoteApp and Desktop Connections Windows Live Language Setting Windows Update Desktop Gadgets Windows Firewall Phone and Modem Speech Recognition User Accounts Region and Language HomeGroup Mouse Folder Options Keyboard Device Manager Windows CardSpace Performance Information and Tools Programs and Features Indexing Options Network and Sharing Center AutoPlay Sync Center Recovery Internet Options Devices and Printers Color Management Backup and Restore System Action Center Fonts Windows Anytime Upgrade Display Troubleshooting Getting Started Administrative Tools Ease of Access Center Windows Defender Date and Time Location and Other Sensors Personalization Sound Java (32-bit) DirectX Realtek HD Audio Manager BDE Administrator (32-bit) Advansys Formativ (32-bit) Mail (32-bit) Microsoft Mail Postoffice (32-bit) Flash Player (32-bit) NVIDIA Control Panel
在32位进程中,输出为:
Java BDE Administrator Advansys Formativ Mail Microsoft Mail Postoffice Flash Player
请注意,64位进程枚举32位项以及64位项。