CTreeCtrl::GetSelectedItem

HTREEITEMGetSelectedItem();

Return Value

The handle of the selected item; otherwise NULL.

Remarks

Call this function to retrieve the currently selected item of the tree view control.

Example

// The pointer to my tree control.
extern CTreeCtrl* pmyTreeCtrl;

// Expand the selected item and make it visible, if possible.
HTREEITEM hItem = pmyTreeCtrl->GetSelectedItem();

if ((hItem != NULL) && pmyTreeCtrl->ItemHasChildren(hItem))
{
   pmyTreeCtrl->Expand(hItem, TVE_EXPAND);
   pmyTreeCtrl->EnsureVisible(hItem);
}

CTreeCtrl OverviewClass MembersHierarchy Chart

See Also   CTreeCtrl::Select, CTreeCtrl::SelectDropTarget, CTreeCtrl::GetDropHilightItem