[EXPLORER] -Use WM_POPUPSYSTEMMENU to open the system menu of a window. CORE-13400

svn path=/trunk/; revision=74972
This commit is contained in:
Giannis Adamopoulos 2017-06-09 09:16:44 +00:00
parent e340056142
commit 19dd22d422

View file

@ -1531,22 +1531,15 @@ public:
VOID HandleTaskItemRightClick(IN OUT PTASK_ITEM TaskItem) VOID HandleTaskItemRightClick(IN OUT PTASK_ITEM TaskItem)
{
HMENU hmenu = ::GetSystemMenu(TaskItem->hWnd, FALSE);
if (hmenu)
{ {
POINT pt; POINT pt;
int cmd;
GetCursorPos(&pt); 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);
{
SetForegroundWindow(TaskItem->hWnd); // reactivate window after the context menu has closed ActivateTask(TaskItem->hWnd);
::PostMessage(TaskItem->hWnd, WM_SYSCOMMAND, cmd, 0);
} ::SendMessageW(TaskItem->hWnd, WM_POPUPSYSTEMMENU, 0, MAKELPARAM(pt.x, pt.y));
}
} }
VOID HandleTaskGroupRightClick(IN OUT PTASK_GROUP TaskGroup) VOID HandleTaskGroupRightClick(IN OUT PTASK_GROUP TaskGroup)