CTreeCtrl::GetChildItem

HTREEITEM GetChildItem( HTREEITEM hItem );

Return Value

The handle of the child item if successful; otherwise NULL.

Parameters

hItem

Handle of a tree item.

Remarks

Call this function to retrieve the tree view item that is the child of the item specified by hItem.

Example

// The pointer to my tree control.
extern CTreeCtrl* pmyTreeCtrl;
// The item whose children will be deleted.
extern HTREEITEM hmyItem;

// Delete all of the children of hmyItem.
if (pmyTreeCtrl->ItemHasChildren(hmyItem))
{
   HTREEITEM hNextItem;
   HTREEITEM hChildItem = pmyTreeCtrl->GetChildItem(hmyItem);

   while (hChildItem != NULL)
   {
      hNextItem = pmyTreeCtrl->GetNextItem(hChildItem, TVGN_NEXT);
      pmyTreeCtrl->DeleteItem(hChildItem);
      hChildItem = hNextItem;
   }
}

CTreeCtrl OverviewClass MembersHierarchy Chart

See Also   CTreeCtrl::GetItem, CTreeCtrl::GetParentItem, CTreeCtrl::SortChildren