Commit 006d3f33 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

regedit: Don't expand items on initial tree creation.

The Message TVM_EXPAND is captured in treeview_notify, then passes g_pChildWnd->hTreeWnd on to OnTreeExpanding which hasn't been initialized yet. The function get_last_key is already called after the hTreeWnd has been assigned to select the previous selected item (if it exists). Signed-off-by: 's avatarAlistair Leslie-Hughes <leslie_alistair@hotmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 760b0de7
......@@ -240,16 +240,21 @@ static void get_last_key(HWND hwndTV)
if (RegCreateKeyExW(HKEY_CURRENT_USER, wszKeyName, 0, NULL, 0, KEY_READ, NULL, &hkey, NULL) == ERROR_SUCCESS)
{
HTREEITEM selection = NULL;
if (RegQueryValueExW(hkey, wszLastKey, NULL, NULL, (LPBYTE)wszVal, &dwSize) == ERROR_SUCCESS)
{
HTREEITEM selection;
if (!strcmpW(wszVal, g_pChildWnd->szPath))
selection = (HTREEITEM)SendMessageW(g_pChildWnd->hTreeWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0);
else
if (strcmpW(wszVal, g_pChildWnd->szPath))
selection = FindPathInTree(hwndTV, wszVal);
SendMessageW(hwndTV, TVM_SELECTITEM, TVGN_CARET, (LPARAM)selection);
}
if(!selection)
{
selection = (HTREEITEM)SendMessageW(g_pChildWnd->hTreeWnd, TVM_GETNEXTITEM, TVGN_ROOT, 0);
SendMessageW(hwndTV, TVM_EXPAND, TVE_EXPAND, (LPARAM)selection );
}
else
SendMessageW(hwndTV, TVM_SELECTITEM, TVGN_CARET, (LPARAM)selection);
RegCloseKey(hkey);
}
}
......
......@@ -572,9 +572,6 @@ static BOOL InitTreeViewItems(HWND hwndTV, LPWSTR pHostName)
if (!AddEntryToTree(hwndTV, hRoot, hkcc, HKEY_CURRENT_CONFIG, 1)) return FALSE;
if (!AddEntryToTree(hwndTV, hRoot, hkdd, HKEY_DYN_DATA, 1)) return FALSE;
/* expand and select host name */
SendMessageW(hwndTV, TVM_EXPAND, TVE_EXPAND, (LPARAM)hRoot );
SendMessageW(hwndTV, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hRoot);
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment