Hugh McMaster : regedit: Use the treeview item label in the 'Favourites' menu instead of the key path.

Alexandre Julliard julliard at winehq.org
Mon Jun 5 16:56:29 CDT 2017


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

Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date:   Mon Jun  5 00:58:04 2017 +0000

regedit: Use the treeview item label in the 'Favourites' menu instead of the key path.

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

---

 programs/regedit/framewnd.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/programs/regedit/framewnd.c b/programs/regedit/framewnd.c
index e654d48..7e48513 100644
--- a/programs/regedit/framewnd.c
+++ b/programs/regedit/framewnd.c
@@ -646,15 +646,21 @@ static INT_PTR CALLBACK addtofavorites_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
     switch(uMsg) {
         case WM_INITDIALOG:
         {
-            HKEY hKeyRoot = NULL;
-            LPWSTR ItemPath = GetItemPath(g_pChildWnd->hTreeWnd, NULL, &hKeyRoot);
+            HTREEITEM selected;
+            TVITEMW item;
+            WCHAR buf[128];
+
+            selected = (HTREEITEM)SendMessageW(g_pChildWnd->hTreeWnd, TVM_GETNEXTITEM, TVGN_CARET, 0);
+
+            item.mask = TVIF_HANDLE | TVIF_TEXT;
+            item.hItem = selected;
+            item.pszText = buf;
+            item.cchTextMax = COUNT_OF(buf);
+            SendMessageW(g_pChildWnd->hTreeWnd, TVM_GETITEMW, 0, (LPARAM)&item);
 
-            if(!ItemPath || !*ItemPath)
-                ItemPath = GetItemFullPath(g_pChildWnd->hTreeWnd, NULL, FALSE);
             EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
-            SetWindowTextW(hwndValue, ItemPath);
+            SetWindowTextW(hwndValue, buf);
             SendMessageW(hwndValue, EM_SETLIMITTEXT, 127, 0);
-            HeapFree(GetProcessHeap(), 0, ItemPath);
             return TRUE;
         }
         case WM_COMMAND:




More information about the wine-cvs mailing list