The TVM_SORTCHILDREN message sorts the child items of the specified parent item in a tree-view control. You can send this message explicitly or by using the TreeView_SortChildren macro.
TVM_SORTCHILDREN wParam = 0; // reserved for future use; must be zero lParam = (LPARAM) (HTREEITEM) hitem;
Returns TRUE if successful or FALSE otherwise.