mirror of
https://github.com/reactos/reactos.git
synced 2025-02-25 01:39:30 +00:00
speedup listing items in the treeview
svn path=/trunk/; revision=8493
This commit is contained in:
parent
772d5765b7
commit
f4ae5098cc
1 changed files with 11 additions and 1 deletions
|
@ -117,7 +117,12 @@ static HTREEITEM AddEntryToTree(HWND hwndTV, HTREEITEM hParent, LPTSTR label, HK
|
|||
tvi.cChildren = dwChildren;
|
||||
tvi.lParam = (LPARAM)hKey;
|
||||
tvins.u.item = tvi;
|
||||
tvins.hInsertAfter = (HTREEITEM)(hKey ? TVI_LAST : TVI_SORT);
|
||||
/*
|
||||
* Inserting items at front is faster then inserting to back.
|
||||
* Sorting after inserting each item is painfully slow...
|
||||
* -Gunnar
|
||||
*/
|
||||
tvins.hInsertAfter = TVI_FIRST;//(HTREEITEM)(hKey ? TVI_LAST : TVI_SORT);
|
||||
tvins.hParent = hParent;
|
||||
return TreeView_InsertItem(hwndTV, &tvins);
|
||||
}
|
||||
|
@ -151,6 +156,8 @@ static BOOL InitTreeViewItems(HWND hwndTV, LPTSTR pHostName)
|
|||
if (!AddEntryToTree(hwndTV, hRoot, _T("HKEY_USERS"), HKEY_USERS, 1)) return FALSE;
|
||||
if (!AddEntryToTree(hwndTV, hRoot, _T("HKEY_CURRENT_CONFIG"), HKEY_CURRENT_CONFIG, 1)) return FALSE;
|
||||
|
||||
SendMessage(hwndTV, TVM_SORTCHILDREN, 0, hRoot);
|
||||
|
||||
/* expand and select host name */
|
||||
TreeView_Expand(hwndTV, hRoot, TVE_EXPAND);
|
||||
TreeView_Select(hwndTV, hRoot, TVGN_CARET);
|
||||
|
@ -242,6 +249,9 @@ BOOL OnTreeExpanding(HWND hwndTV, NMTREEVIEW* pnmtv)
|
|||
printf("dwSubCount=%ld, Name=%s\n", dwSubCount, Name);
|
||||
AddEntryToTree(hwndTV, pnmtv->itemNew.hItem, Name, NULL, dwSubCount);
|
||||
}
|
||||
|
||||
SendMessage(hwndTV, TVM_SORTCHILDREN, 0, pnmtv->itemNew.hItem);
|
||||
|
||||
RegCloseKey(hNewKey);
|
||||
HeapFree(GetProcessHeap(), 0, Name);
|
||||
|
||||
|
|
Loading…
Reference in a new issue