如题。我自己用了 一个间接的办法,就是得到系统 桌面右键菜单,然后通过 这个执行菜单 撤销命令。但Invokecommand 函数返回S_OK。但系统没有任何效果。有谁弄过这个。求教。
OleInitialize(NULL);
IShellFolder * pIShellFolder = NULL;
SHGetDesktopFolder(&pIShellFolder);
IShellView * pIShellView = NULL;
pIShellFolder->CreateViewObject(NULL, IID_IShellView, (LPVOID*)&pIShellView);
pIShellFolder->Release();
IContextMenu * pIContextMenu = NULL;
pIShellView->GetItemObject(SVGIO_BACKGROUND, IID_IContextMenu, (LPVOID*)&pIContextMenu);
pIShellView->Release();
HMENU hmenuCtx = CreatePopupMenu();
HRESULT hr = pIContextMenu->QueryContextMenu(hmenuCtx, 0, 1, 0x00007FFF, CMF_NORMAL | CMF_VERBSONLY);
CMINVOKECOMMANDINFOEX CmdInfoEx = { 0 };
CmdInfoEx.cbSize = sizeof(CMINVOKECOMMANDINFOEX);
CmdInfoEx.fMask = CMIC_MASK_FLAG_NO_UI;
CmdInfoEx.lpVerb = (LPCSTR)(INT_PTR)MAKEINTRESOURCE(uiCommand - 1);
#ifdef UNICODE
CmdInfoEx.lpVerbW = (LPCWSTR)(INT_PTR)MAKEINTRESOURCE(uiCommand - 1);
CmdInfoEx.fMask |= CMIC_MASK_UNICODE;
#endif
hr = pIContextMenu->InvokeCommand((CMINVOKECOMMANDINFO*)&CmdInfoEx);
pIContextMenu->Release();