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

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2017-06-05 00:58:04 +00:00 committed by Alexandre Julliard
parent 27b2519ca4
commit 46bff016ab
1 changed files with 12 additions and 6 deletions

View File

@ -646,15 +646,21 @@ static INT_PTR CALLBACK addtofavorites_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w
switch(uMsg) { switch(uMsg) {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
HKEY hKeyRoot = NULL; HTREEITEM selected;
LPWSTR ItemPath = GetItemPath(g_pChildWnd->hTreeWnd, NULL, &hKeyRoot); 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); EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
SetWindowTextW(hwndValue, ItemPath); SetWindowTextW(hwndValue, buf);
SendMessageW(hwndValue, EM_SETLIMITTEXT, 127, 0); SendMessageW(hwndValue, EM_SETLIMITTEXT, 127, 0);
HeapFree(GetProcessHeap(), 0, ItemPath);
return TRUE; return TRUE;
} }
case WM_COMMAND: case WM_COMMAND: