mirror of
https://github.com/reactos/reactos.git
synced 2024-08-04 10:30:59 +00:00
* Try to invoke items by executing the default context menu action
* Fixes executing of items like network connections folder whose items are no file system objects * Colin's wish list (1/2) :) svn path=/trunk/; revision=37063
This commit is contained in:
parent
ad83e0cde9
commit
40944938d8
|
@ -835,6 +835,8 @@ static HRESULT ShellView_OpenSelectedItems(IShellViewImpl * This)
|
|||
static UINT CF_IDLIST = 0;
|
||||
HRESULT hr;
|
||||
IDataObject* selection;
|
||||
IContextMenu * cm;
|
||||
HMENU hmenu;
|
||||
FORMATETC fetc;
|
||||
STGMEDIUM stgm;
|
||||
LPIDA pIDList;
|
||||
|
@ -843,14 +845,68 @@ static HRESULT ShellView_OpenSelectedItems(IShellViewImpl * This)
|
|||
LPCWSTR parent_dir = NULL;
|
||||
SFGAOF attribs;
|
||||
int i;
|
||||
CMINVOKECOMMANDINFOEX ici;
|
||||
MENUITEMINFOW info;
|
||||
|
||||
if (0 == ShellView_GetSelections(This))
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
hr = IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl,
|
||||
(LPCITEMIDLIST*)This->apidl, &IID_IContextMenu,
|
||||
0, (LPVOID *)&cm);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
hmenu = CreatePopupMenu();
|
||||
if (hmenu)
|
||||
{
|
||||
if (SUCCEEDED(IContextMenu_QueryContextMenu( cm, hmenu, 0, 0x20, 0x7fff, CMF_DEFAULTONLY)))
|
||||
{
|
||||
INT def = -1, n = GetMenuItemCount(hmenu);
|
||||
|
||||
for ( i = 0; i < n; i++ )
|
||||
{
|
||||
memset( &info, 0, sizeof info );
|
||||
info.cbSize = sizeof info;
|
||||
info.fMask = MIIM_FTYPE | MIIM_STATE | MIIM_ID;
|
||||
if (GetMenuItemInfoW( hmenu, i, TRUE, &info))
|
||||
{
|
||||
if (info.fState & MFS_DEFAULT)
|
||||
{
|
||||
def = info.wID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (def != -1)
|
||||
{
|
||||
memset( &ici, 0, sizeof ici );
|
||||
ici.cbSize = sizeof ici;
|
||||
ici.lpVerb = MAKEINTRESOURCEA( def );
|
||||
ici.hwnd = This->hWnd;
|
||||
|
||||
IContextMenu_InvokeCommand(cm, (LPCMINVOKECOMMANDINFO) &ici );
|
||||
IContextMenu_Release(cm);
|
||||
DestroyMenu( hmenu );
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
}
|
||||
DestroyMenu( hmenu );
|
||||
}
|
||||
IContextMenu_Release(cm);
|
||||
}
|
||||
|
||||
|
||||
|
||||
hr = IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl,
|
||||
(LPCITEMIDLIST*)This->apidl, &IID_IDataObject,
|
||||
0, (LPVOID *)&selection);
|
||||
|
||||
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
|
|
Loading…
Reference in a new issue