CTreeCtrl::GetItemData

DWORD GetItemData( HTREEITEM hItem ) const;

Return Value

A 32-bit application-specific value associated with the item specified by hItem.

Parameters

hItem

Handle of the item whose data is to be retrieved.

Remarks

Call this function to retrieve the 32-bit application-specific value associated with the specified item.

Example

// The pointer to my tree control.
extern CTreeCtrl* pmyTreeCtrl;
// The item whose siblings will be checked.
extern HTREEITEM hmyItem;
   
// Delete all of the children of hmyItem whose item data is
// not equal to zero.
if (pmyTreeCtrl->ItemHasChildren(hmyItem))
{
   HTREEITEM hNextItem;
   HTREEITEM hChildItem = pmyTreeCtrl->GetChildItem(hmyItem);

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

      hChildItem = hNextItem;
   }
}

CTreeCtrl OverviewClass MembersHierarchy Chart

See Also   CTreeCtrl::SetItemData