Hugh McMaster : regedit: Select the targeted treeview item on right mouse click.

Alexandre Julliard julliard at winehq.org
Thu Apr 20 16:41:34 CDT 2017


Module: wine
Branch: master
Commit: ab0d0c6ee4325670f66a68af4f06fbd9acbb6151
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ab0d0c6ee4325670f66a68af4f06fbd9acbb6151

Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date:   Mon Apr 17 09:15:36 2017 +0000

regedit: Select the targeted treeview item on right mouse click.

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/regedit/childwnd.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/programs/regedit/childwnd.c b/programs/regedit/childwnd.c
index 4d184c3..df7c640 100644
--- a/programs/regedit/childwnd.c
+++ b/programs/regedit/childwnd.c
@@ -372,9 +372,14 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
         break;
 
     case WM_CONTEXTMENU: {
-        int x = GET_X_LPARAM(lParam);
-        int y = GET_Y_LPARAM(lParam);
-        TrackPopupMenu(GetSubMenu(hPopupMenus, PM_NEW), TPM_RIGHTBUTTON, x, y, 0, hFrameWnd, NULL);
+        POINT pt = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
+        TVHITTESTINFO ht;
+        ht.pt = pt;
+        ScreenToClient(g_pChildWnd->hTreeWnd, &ht.pt);
+        if (SendMessageW(g_pChildWnd->hTreeWnd, TVM_HITTEST, 0, (LPARAM)&ht))
+            SendMessageW(g_pChildWnd->hTreeWnd, TVM_SELECTITEM, TVGN_CARET, (LPARAM)ht.hItem);
+        TrackPopupMenu(GetSubMenu(hPopupMenus, PM_NEW), TPM_RIGHTBUTTON,
+                       pt.x, pt.y, 0, hFrameWnd, NULL);
     }
 
     case WM_KEYDOWN:




More information about the wine-cvs mailing list