From: Giannis Adamopoulos Date: Fri, 9 Jun 2017 09:16:44 +0000 (+0000) Subject: [EXPLORER] -Use WM_POPUPSYSTEMMENU to open the system menu of a window. CORE-13400 X-Git-Tag: ReactOS-0.4.6~370 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=19dd22d42218da03ab748879aa3c3e288f41697e;hp=e340056142439778646ed9eba5744454dc52cb37 [EXPLORER] -Use WM_POPUPSYSTEMMENU to open the system menu of a window. CORE-13400 svn path=/trunk/; revision=74972 --- diff --git a/reactos/base/shell/explorer/taskswnd.cpp b/reactos/base/shell/explorer/taskswnd.cpp index ae22e7677c2..b673482443c 100644 --- a/reactos/base/shell/explorer/taskswnd.cpp +++ b/reactos/base/shell/explorer/taskswnd.cpp @@ -1532,21 +1532,14 @@ public: VOID HandleTaskItemRightClick(IN OUT PTASK_ITEM TaskItem) { + POINT pt; + GetCursorPos(&pt); - HMENU hmenu = ::GetSystemMenu(TaskItem->hWnd, FALSE); + SetForegroundWindow(TaskItem->hWnd); - if (hmenu) - { - POINT pt; - int cmd; - GetCursorPos(&pt); - cmd = TrackPopupMenu(hmenu, TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, m_TaskBar.m_hWnd, NULL); - if (cmd) - { - SetForegroundWindow(TaskItem->hWnd); // reactivate window after the context menu has closed - ::PostMessage(TaskItem->hWnd, WM_SYSCOMMAND, cmd, 0); - } - } + ActivateTask(TaskItem->hWnd); + + ::SendMessageW(TaskItem->hWnd, WM_POPUPSYSTEMMENU, 0, MAKELPARAM(pt.x, pt.y)); } VOID HandleTaskGroupRightClick(IN OUT PTASK_GROUP TaskGroup)