CTreeCtrl::GetItemState

Returns the state of the item specified by hItem.

UINT GetItemState(
   HTREEITEM hItem,
   UINT nStateMask 
) const;

Parameters

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

  • nStateMask
    Mask indicating one or more states to be retrieved. For more information on possible values for nStateMask, see the discussion of the state and stateMask members of the TVITEM structure in the Windows SDK.

Return Value

A UINT that holds the bitwise OR of the values specified by nStateMask. For information on possible values, see CTreeCtrl::GetItem. To find the value for a specific state, perform a bitwise AND operation of the state value and the return value, as shown in the following example.

Example

// Show all of the visible items in bold.
HTREEITEM hItem = m_TreeCtrl.GetFirstVisibleItem();

while (hItem != NULL)
{
   m_TreeCtrl.SetItemState(hItem, TVIS_BOLD, TVIS_BOLD);
   ASSERT(TVIS_BOLD & m_TreeCtrl.GetItemState(hItem, TVIS_BOLD));
   hItem = m_TreeCtrl.GetNextVisibleItem(hItem);
}

Requirements

Header: afxcmn.h

See Also

Reference

CTreeCtrl Class

Hierarchy Chart

CTreeCtrl::GetItem

Concepts

Tree Control Item States Overview

Other Resources

CTreeCtrl Members