CTreeCtrl::SetItemData

BOOL SetItemData( HTREEITEM hItem, DWORD dwData );

Return Value

Nonzero if successful; otherwise 0.

Parameters

hItem

Handle of the item whose data is to be retrieved.

dwData

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

Remarks

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

Example

// The pointer to my tree control.
extern CTreeCtrl* pmyTreeCtrl;
CString   str;
HTREEITEM hItem;

// Insert 20 items into the tree control making every item's
// data be the handle of the item.
for (int i=0;i < 20;i++)
{
   str.Format(TEXT("item %d"), i);
   hItem = pmyTreeCtrl->InsertItem(str);

   if (hItem != NULL)
   {
      pmyTreeCtrl->SetItemData(hItem, (DWORD) hItem);
   }
}

CTreeCtrl OverviewClass MembersHierarchy Chart

See Also   CTreeCtrl::GetItemData