On Friday, 17 February 2017 9:42 AM, Nikolay Sivov wrote:
--- a/programs/regedit/treeview.c +++ b/programs/regedit/treeview.c @@ -477,12 +477,12 @@ BOOL RefreshTreeView(HWND hwndTV) hItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hRoot); while (hItem) { RefreshTreeItem(hwndTV, hItem); + SendMessageW(hwndTV, TVM_SORTCHILDREN, TRUE, (LPARAM)hItem); hItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); } SendMessageW(hwndTV, WM_SETREDRAW, TRUE, 0); InvalidateRect(hwndTV, NULL, FALSE); - SendMessageW(hwndTV, TVM_SORTCHILDREN, TRUE, (LPARAM)hSelectedItem); SetCursor(hcursorOld);
This doesn't seem to work. None of the treeview nodes are sorted when you click Refresh or press F5, but immediate children were sorted before this patch. Can you please take another look?
This is probably due to an incomplete TREEVIEW_SortChildren() function in comctl32.
case TVM_SORTCHILDREN: return TREEVIEW_SortChildren(infoPtr, lParam);
Note that we ignore the wParam, which MSDN says is a "Value that specifies whether the sorting is recursive. Set wParam to TRUE to sort all levels of child items below the parent item. Otherwise, only the parent's immediate children are sorted. "
-- Hugh McMaster