我需要帮助来创建一个 IDataObject 以启用这 2 个项目(运行和帮助)的拖放。例如,我需要像 Windows 开始菜单那样做。
运行它们我使用这些
CComPtr<IShellDispatch2> pShellDisp;
if (SUCCEEDED(CoCreateInstance(CLSID_Shell,NULL,CLSCTX_SERVER,IID_IShellDispatch2,(void**)&pShellDisp)))
{
pShellDisp->Help(); //Help
pShellDisp->FileRun(); //Run
}
你们能帮帮我吗?
PS:我也需要带有图像图标的拖动
编辑[已解决]
IShellFolder* desk = NULL;
HRESULT hr =SHGetDesktopFolder(&desk);
LPITEMIDLIST pidl2=NULL;
ULONG cbEaten;
DWORD dwAttribs = 0 ;
hr = desk->ParseDisplayName(NULL,
NULL,
L"shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}",
&cbEaten, // This can be NULL
&pidl2,
&dwAttribs);
hr = desk->GetUIObjectOf(parentHwnd, 1,
(PCITEMID_CHILD*)&pidl2, IID_IDataObject, 0, (LPVOID *)lpdataObj);
desk->Release();
return;
运行:
shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0}