mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[SHLWAPI][SDK] Implement IContextMenu_Invoke (#5856)
- Modify shlwapi.spec. - Add dll/win32/shlwapi/utils.cpp. - Implement IContextMenu_Invoke function. - Add it to <shlwapi_undoc.h>. CORE-19278
This commit is contained in:
parent
43d6fdf2be
commit
0ae6a509b0
4 changed files with 88 additions and 1 deletions
|
@ -25,6 +25,7 @@ list(APPEND SOURCE
|
|||
list(APPEND PCH_SKIP_SOURCE
|
||||
assoc.c
|
||||
propbag.cpp
|
||||
utils.cpp
|
||||
wsprintf.c
|
||||
${CMAKE_CURRENT_BINARY_DIR}/shlwapi_stubs.c)
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@
|
|||
204 stdcall -noname SHIsChildOrSelf(long long)
|
||||
205 stdcall -noname SHGetValueGoodBootA(long str str ptr ptr ptr)
|
||||
206 stdcall -noname SHGetValueGoodBootW(long wstr wstr ptr ptr ptr)
|
||||
207 stub -noname IContextMenu_Invoke
|
||||
207 stdcall -noname IContextMenu_Invoke(ptr ptr str long)
|
||||
208 stdcall -noname FDSA_Initialize(long long ptr ptr long)
|
||||
209 stdcall -noname FDSA_Destroy(ptr)
|
||||
210 stdcall -noname FDSA_InsertItem(ptr long ptr)
|
||||
|
|
79
dll/win32/shlwapi/utils.cpp
Normal file
79
dll/win32/shlwapi/utils.cpp
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Shell
|
||||
* LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
|
||||
* PURPOSE: Implement shell light-weight utility functions
|
||||
* COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
||||
*/
|
||||
|
||||
#define _ATL_NO_EXCEPTIONS
|
||||
#include "precomp.h"
|
||||
#include <shellapi.h>
|
||||
#include <shlwapi.h>
|
||||
#include <shlwapi_undoc.h>
|
||||
#include <shlobj_undoc.h>
|
||||
#include <shlguid_undoc.h>
|
||||
#include <atlstr.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(shell);
|
||||
|
||||
/*************************************************************************
|
||||
* IContextMenu_Invoke [SHLWAPI.207]
|
||||
*
|
||||
* Used by Win:SHELL32!CISFBand::_TrySimpleInvoke.
|
||||
*/
|
||||
EXTERN_C
|
||||
BOOL WINAPI
|
||||
IContextMenu_Invoke(
|
||||
_In_ IContextMenu *pContextMenu,
|
||||
_In_ HWND hwnd,
|
||||
_In_ LPCSTR lpVerb,
|
||||
_In_ UINT uFlags)
|
||||
{
|
||||
CMINVOKECOMMANDINFO info;
|
||||
BOOL ret = FALSE;
|
||||
INT iDefItem = 0;
|
||||
HMENU hMenu = NULL;
|
||||
HCURSOR hOldCursor;
|
||||
|
||||
TRACE("(%p, %p, %s, %u)\n", pContextMenu, hwnd, debugstr_a(lpVerb), uFlags);
|
||||
|
||||
if (!pContextMenu)
|
||||
return FALSE;
|
||||
|
||||
hOldCursor = SetCursor(LoadCursorW(NULL, (LPCWSTR)IDC_WAIT));
|
||||
|
||||
ZeroMemory(&info, sizeof(info));
|
||||
info.cbSize = sizeof(info);
|
||||
info.hwnd = hwnd;
|
||||
info.nShow = SW_NORMAL;
|
||||
info.lpVerb = lpVerb;
|
||||
|
||||
if (IS_INTRESOURCE(lpVerb))
|
||||
{
|
||||
hMenu = CreatePopupMenu();
|
||||
if (hMenu)
|
||||
{
|
||||
pContextMenu->QueryContextMenu(hMenu, 0, 1, MAXSHORT, uFlags | CMF_DEFAULTONLY);
|
||||
iDefItem = GetMenuDefaultItem(hMenu, 0, 0);
|
||||
if (iDefItem != -1)
|
||||
info.lpVerb = MAKEINTRESOURCEA(iDefItem - 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (iDefItem != -1 || info.lpVerb)
|
||||
{
|
||||
if (!hwnd)
|
||||
info.fMask |= CMIC_MASK_FLAG_NO_UI;
|
||||
ret = SUCCEEDED(pContextMenu->InvokeCommand(&info));
|
||||
}
|
||||
|
||||
/* Invoking itself doesn't need the menu object, but getting the command info
|
||||
needs the menu. */
|
||||
if (hMenu)
|
||||
DestroyMenu(hMenu);
|
||||
|
||||
SetCursor(hOldCursor);
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -278,6 +278,13 @@ VOID WINAPI FixSlashesAndColonW(LPWSTR);
|
|||
BOOL WINAPI PathIsValidCharW(WCHAR c, DWORD dwClass);
|
||||
BOOL WINAPI SHGetPathFromIDListWrapW(LPCITEMIDLIST pidl, LPWSTR pszPath);
|
||||
|
||||
BOOL WINAPI
|
||||
IContextMenu_Invoke(
|
||||
_In_ IContextMenu *pContextMenu,
|
||||
_In_ HWND hwnd,
|
||||
_In_ LPCSTR lpVerb,
|
||||
_In_ UINT uFlags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif /* defined(__cplusplus) */
|
||||
|
|
Loading…
Reference in a new issue