IShellFolder::ParseDisplayName 获取控制面板项目的 ITEMIDLIST

IShellFolder::ParseDisplayName to get ITEMIDLIST for Control Panel Item

我有 Shell 个文件夹,它是一个控制面板项。我正在尝试获取相同的 ITEMIDLIST。我有 Shell 文件夹 GUID。

按照文档进行

https://msdn.microsoft.com/en-us/library/windows/desktop/bb775090%28v=vs.85%29.aspx

https://msdn.microsoft.com/en-us/LIBRary/ms909875.aspx,不一致

并说明我可以在桌面文件夹中使用 ::{GUID} 语法指定显示名称,我试过

::{CLSID for Control Panel}\::{CLSID for my Shell folder}.

但是这不起作用,因为我最终得到的是控制面板的 ITEMIDLIST。如何将 ITEMIDLIST 获取到控制面板项目?

根据@Denis Anisimov 建议的答案,我仍然面临 ParseDisplayName 问题。

int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
HRESULT hres;
LPSHELLFOLDER cPanel;
LPSHELLFOLDER DesktopFolder;
LPITEMIDLIST cpItemPidl;
LPITEMIDLIST pidl;
SHGetDesktopFolder(&DesktopFolder);
SHGetKnownFolderIDList(FOLDERID_ControlPanelFolder, CSIDL_CONTROLS, NULL, &pidl);
hres = DesktopFolder->BindToObject(pidl, NULL, IID_IShellFolder, (void**)&cPanel);
LPWSTR SFOLDERGUID = L"::{025A5937-A6BE-4686-A844-36FE4BEC8B6D}";

hres = cPanel->ParseDisplayName(NULL, NULL, SFOLDERGUID, NULL, &cpItemPidl, NULL);
}

我得到 hres 为

E_INVALIDARG One or more arguments are invalid.

我的部分工作项目(是Delphi但主要原理可见):

function CreatePluginsPIDL: PItemIDList;
var
  ControlPanelPIDL: PItemIDList;
  PluginsParsingName: UnicodeString;
  Desktop: IShellFolder;
  ControlPanelFolder: IShellFolder;
  Eaten: DWORD;
  Attr: DWORD;
  Child: PItemIDList;
begin
  ControlPanelPIDL := GetKnownFolderIDList(FOLDERID_ControlPanelFolder, CSIDL_CONTROLS);
  try
    OleCheck(SHGetDesktopFolder(Desktop));
    try
      OleCheck(Desktop.BindToObject(ControlPanelPIDL, nil, IShellFolder, ControlPanelFolder));
      try
        PluginsParsingName := '::' + GUIDToString(TTC4ShellCPNamespaceCLSID);
        Attr := 0;
        OleCheck(ControlPanelFolder.ParseDisplayName(0, nil, PWideChar(PluginsParsingName), Eaten, Child, Attr));
        try
          Result := ILCombine_(ControlPanelPIDL, Child);
        finally
          CoTaskMemFree(Child);
        end;
      finally
        ControlPanelFolder := nil;
      end;
    finally
      Desktop := nil;
    end;
  finally
    CoTaskMemFree(ControlPanelPIDL);
  end;
end;