共用方式為


CTreeCtrl::SortChildren

Call this function to alphabetically sort the child items of the given parent item in a tree view control.

BOOL SortChildren( 
   HTREEITEM hItem  
);

Parameters

  • hItem
    Handle of the parent item whose child items are to be sorted. If hItem is NULL, sorting will proceed from the root of the tree.

Return Value

Nonzero if successful; otherwise 0.

Remarks

SortChildren will not recurse through the tree; only the immediate children of hItem will be sorted.

Example

// Sort all of the items in the tree control.
m_TreeCtrl.SortChildren(TVI_ROOT);

Requirements

Header: afxcmn.h

See Also

Reference

CTreeCtrl Class

Hierarchy Chart

CTreeCtrl::SortChildrenCB