Commit 2bb1059a authored by David Quintana's avatar David Quintana Committed by Alexandre Julliard

shlwapi: SHInvokeCommand last parameter is a command ID, or 0 to use the default.

parent 5b0c2889
...@@ -60,7 +60,7 @@ extern HINSTANCE shlwapi_hInstance; ...@@ -60,7 +60,7 @@ extern HINSTANCE shlwapi_hInstance;
extern DWORD SHLWAPI_ThreadRef_index; extern DWORD SHLWAPI_ThreadRef_index;
HRESULT WINAPI IUnknown_QueryService(IUnknown*,REFGUID,REFIID,LPVOID*); HRESULT WINAPI IUnknown_QueryService(IUnknown*,REFGUID,REFIID,LPVOID*);
HRESULT WINAPI SHInvokeCommand(HWND,IShellFolder*,LPCITEMIDLIST,BOOL); HRESULT WINAPI SHInvokeCommand(HWND,IShellFolder*,LPCITEMIDLIST,DWORD);
BOOL WINAPI SHAboutInfoW(LPWSTR,DWORD); BOOL WINAPI SHAboutInfoW(LPWSTR,DWORD);
/* /*
...@@ -2933,7 +2933,7 @@ HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, HWND hWndParent, DWORD dwExStyle ...@@ -2933,7 +2933,7 @@ HWND WINAPI SHCreateWorkerWindowW(LONG wndProc, HWND hWndParent, DWORD dwExStyle
HRESULT WINAPI SHInvokeDefaultCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST lpApidl) HRESULT WINAPI SHInvokeDefaultCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST lpApidl)
{ {
TRACE("%p %p %p\n", hWnd, lpFolder, lpApidl); TRACE("%p %p %p\n", hWnd, lpFolder, lpApidl);
return SHInvokeCommand(hWnd, lpFolder, lpApidl, FALSE); return SHInvokeCommand(hWnd, lpFolder, lpApidl, 0);
} }
/************************************************************************* /*************************************************************************
...@@ -3481,19 +3481,19 @@ UINT WINAPI SHDefExtractIconWrapW(LPCWSTR pszIconFile, int iIndex, UINT uFlags, ...@@ -3481,19 +3481,19 @@ UINT WINAPI SHDefExtractIconWrapW(LPCWSTR pszIconFile, int iIndex, UINT uFlags,
* hWnd [I] Window displaying the shell folder * hWnd [I] Window displaying the shell folder
* lpFolder [I] IShellFolder interface * lpFolder [I] IShellFolder interface
* lpApidl [I] Id for the particular folder desired * lpApidl [I] Id for the particular folder desired
* bInvokeDefault [I] Whether to invoke the default menu item * dwCommandId [I] The command ID to invoke (0=invoke default)
* *
* RETURNS * RETURNS
* Success: S_OK. If bInvokeDefault is TRUE, the default menu action was * Success: S_OK. If bInvokeDefault is TRUE, the default menu action was
* executed. * executed.
* Failure: An HRESULT error code indicating the error. * Failure: An HRESULT error code indicating the error.
*/ */
HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST lpApidl, BOOL bInvokeDefault) HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST lpApidl, DWORD dwCommandId)
{ {
IContextMenu *iContext; IContextMenu *iContext;
HRESULT hRet; HRESULT hRet;
TRACE("(%p, %p, %p, %d)\n", hWnd, lpFolder, lpApidl, bInvokeDefault); TRACE("(%p, %p, %p, %u)\n", hWnd, lpFolder, lpApidl, dwCommandId);
if (!lpFolder) if (!lpFolder)
return E_FAIL; return E_FAIL;
...@@ -3507,16 +3507,16 @@ HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST ...@@ -3507,16 +3507,16 @@ HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST
if ((hMenu = CreatePopupMenu())) if ((hMenu = CreatePopupMenu()))
{ {
HRESULT hQuery; HRESULT hQuery;
DWORD dwDefaultId = 0;
/* Add the context menu entries to the popup */ /* Add the context menu entries to the popup */
hQuery = IContextMenu_QueryContextMenu(iContext, hMenu, 0, 1, 0x7FFF, hQuery = IContextMenu_QueryContextMenu(iContext, hMenu, 0, 1, 0x7FFF,
bInvokeDefault ? CMF_NORMAL : CMF_DEFAULTONLY); dwCommandId ? CMF_NORMAL : CMF_DEFAULTONLY);
if (SUCCEEDED(hQuery)) if (SUCCEEDED(hQuery))
{ {
if (bInvokeDefault && if (!dwCommandId)
(dwDefaultId = GetMenuDefaultItem(hMenu, 0, 0)) != (UINT)-1) dwCommandId = GetMenuDefaultItem(hMenu, 0, 0);
if (dwCommandId != (UINT)-1)
{ {
CMINVOKECOMMANDINFO cmIci; CMINVOKECOMMANDINFO cmIci;
/* Invoke the default item */ /* Invoke the default item */
...@@ -3524,8 +3524,8 @@ HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST ...@@ -3524,8 +3524,8 @@ HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST
cmIci.cbSize = sizeof(cmIci); cmIci.cbSize = sizeof(cmIci);
cmIci.fMask = CMIC_MASK_ASYNCOK; cmIci.fMask = CMIC_MASK_ASYNCOK;
cmIci.hwnd = hWnd; cmIci.hwnd = hWnd;
cmIci.lpVerb = MAKEINTRESOURCEA(dwDefaultId); cmIci.lpVerb = MAKEINTRESOURCEA(dwCommandId);
cmIci.nShow = SW_SCROLLCHILDREN; cmIci.nShow = SW_SHOWNORMAL;
hRet = IContextMenu_InvokeCommand(iContext, &cmIci); hRet = IContextMenu_InvokeCommand(iContext, &cmIci);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment