Partilhar via


CTreeCtrl::SelectItem

Call this function to select the given tree view item.

BOOL SelectItem(
   HTREEITEM hItem 
);

Parameters

  • hItem
    Handle of a tree item.

Return Value

Nonzero if successful; otherwise 0.

Remarks

If hItem is NULL, then this function selects no item.

Example

// Select the item that is at the point myPoint.
UINT uFlags;
HTREEITEM hItem = m_TreeCtrl.HitTest(myPoint, &uFlags);

if ((hItem != NULL) && (TVHT_ONITEM & uFlags))
{
   m_TreeCtrl.SelectItem(hItem);
}

Requirements

Header: afxcmn.h

See Also

Reference

CTreeCtrl Class

Hierarchy Chart

CTreeCtrl::Select

CTreeCtrl::GetSelectedItem

CTreeCtrl::SelectDropTarget

Other Resources

CTreeCtrl Members