How to get a windows control panel in x64 system?
-
24-07-2021 - |
Question
I use Shell to get control panel
Code :
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;
it only can get control panels in 32-bit like : BDE Administrator (32 bit) , Flash Player (32 bit), and my operating system is x64 , I wonder how to get all (32bit & 64bit) control panel ?
La solution
You need to compile your code as a 64 bit process to see the 64 bit control panel items. That needs XE2 or later. When I try your code in a 64 bit process the output is as follows:
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
In a 32 bit process the output is:
Java BDE Administrator Advansys Formativ Mail Microsoft Mail Postoffice Flash Player
Note that the 64 bit process enumerates the 32 bit items as well as the 64 bit items.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow