2012-11-01 25 views
1

我使用殼牌得到控制面板如何在x64系統中獲得Windows控制面板?

代碼:

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播放器(32位), 和我的操作系統是x64,我不知道如何獲得所有(32bit & 64bit)控制面板?

+0

您的32位進程正在模擬器WOW64中運行。使用64位進程。 –

+3

換句話說,如果您有Delphi XE2或XE3,請將您的Delphi目標從Win32更改爲Win64。如果你還沒有它,得到一個現代的32 + 64位德爾福版本。 –

+0

@DavidHeffernan我打算髮表你所說的答案,但我發表了你的評論,你爲什麼不把它作爲答案發布? – jachguate

回答

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位的項目。

相關問題