mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 09:25:44 +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
1 changed files with 56 additions and 0 deletions
|
@ -835,6 +835,8 @@ static HRESULT ShellView_OpenSelectedItems(IShellViewImpl * This)
|
||||||
static UINT CF_IDLIST = 0;
|
static UINT CF_IDLIST = 0;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
IDataObject* selection;
|
IDataObject* selection;
|
||||||
|
IContextMenu * cm;
|
||||||
|
HMENU hmenu;
|
||||||
FORMATETC fetc;
|
FORMATETC fetc;
|
||||||
STGMEDIUM stgm;
|
STGMEDIUM stgm;
|
||||||
LPIDA pIDList;
|
LPIDA pIDList;
|
||||||
|
@ -843,14 +845,68 @@ static HRESULT ShellView_OpenSelectedItems(IShellViewImpl * This)
|
||||||
LPCWSTR parent_dir = NULL;
|
LPCWSTR parent_dir = NULL;
|
||||||
SFGAOF attribs;
|
SFGAOF attribs;
|
||||||
int i;
|
int i;
|
||||||
|
CMINVOKECOMMANDINFOEX ici;
|
||||||
|
MENUITEMINFOW info;
|
||||||
|
|
||||||
if (0 == ShellView_GetSelections(This))
|
if (0 == ShellView_GetSelections(This))
|
||||||
{
|
{
|
||||||
return S_OK;
|
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,
|
hr = IShellFolder_GetUIObjectOf(This->pSFParent, This->hWnd, This->cidl,
|
||||||
(LPCITEMIDLIST*)This->apidl, &IID_IDataObject,
|
(LPCITEMIDLIST*)This->apidl, &IID_IDataObject,
|
||||||
0, (LPVOID *)&selection);
|
0, (LPVOID *)&selection);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue