From 4d326b81dcaafb82bcea790171a3c0ff6f6fcee5 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sun, 1 Feb 2004 19:17:31 +0000 Subject: [PATCH] implemented context menu for file child windows svn path=/trunk/; revision=7969 --- .../system/explorer/shell/filechild.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/reactos/subsys/system/explorer/shell/filechild.cpp b/reactos/subsys/system/explorer/shell/filechild.cpp index b44bc921086..a010b94e7ad 100644 --- a/reactos/subsys/system/explorer/shell/filechild.cpp +++ b/reactos/subsys/system/explorer/shell/filechild.cpp @@ -410,6 +410,26 @@ LRESULT FileChildWindow::WndProc(UINT nmsg, WPARAM wparam, LPARAM lparam) return TRUE;} + case WM_CONTEXTMENU: { + // first select the current item in the listbox + HWND hpanel = (HWND) wparam; + POINTS& pos = MAKEPOINTS(lparam); + POINT pt; POINTSTOPOINT(pt, pos); + ScreenToClient(hpanel, &pt); + SendMessage(hpanel, WM_LBUTTONDOWN, 0, MAKELONG(pt.x, pt.y)); + SendMessage(hpanel, WM_LBUTTONUP, 0, MAKELONG(pt.x, pt.y)); + + // now create the popup menu using shell namespace and IContextMenu + Pane* pane = GetFocus()==_left_hwnd? _left: _right; + int idx = ListBox_GetCurSel(*pane); + Entry* entry = (Entry*) ListBox_GetItemData(*pane, idx); + + ShellPath shell_path = entry->create_absolute_pidl(); + LPCITEMIDLIST pidl = shell_path; + + CHECKERROR(ShellFolderContextMenu(Desktop(), _hwnd, 1, &pidl, pos.x, pos.y)); + break;} + default: def: return super::WndProc(nmsg, wparam, lparam); }