Поделиться через


CTreeCtrl::GetItemData

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

DWORD_PTR GetItemData(
   HTREEITEM hItem 
) const;

Параметры

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

Возвращаемое значение

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

Пример

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;
   }
}

Требования

Header: afxcmn.h

См. также

Основные понятия

CTreeCtrl Class

CTreeCtrl Members

Hierarchy Chart

CTreeCtrl::SetItemData