Freigeben über


CTreeCtrl::GetItemData

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

DWORD_PTR GetItemData(
   HTREEITEM hItem 
) const;

Parameters

  • hItem
    Handle of the item whose data is to be retrieved.

Return Value

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

Example

HTREEITEM hmyItem = m_TreeCtrl.GetSelectedItem();

// Delete all of the children of hmyItem whose item data is
// not equal to zero.
if (m_TreeCtrl.ItemHasChildren(hmyItem))
{
   HTREEITEM hNextItem;
   HTREEITEM hChildItem = m_TreeCtrl.GetChildItem(hmyItem);

   while (hChildItem != NULL)
   {
      hNextItem = m_TreeCtrl.GetNextItem(hChildItem, TVGN_NEXT);

      if (m_TreeCtrl.GetItemData(hChildItem) != 0)
      {
         m_TreeCtrl.DeleteItem(hChildItem);
      }

      hChildItem = hNextItem;
   }
}

Requirements

Header: afxcmn.h

See Also

Reference

CTreeCtrl Class

Hierarchy Chart

CTreeCtrl::SetItemData

Other Resources

CTreeCtrl Members