Compartilhar via


CTreeCtrl::MapAccIdToItem

Maps the specified accessibility identifier to the handle of a tree-view item in the current tree-view control.

HTREEITEM MapAccIdToItem(
          UINT uAccId
) const;

Parameters

Parameter

Description

[in] uAccId

An accessibility identifier for an element in the tree-view item.

Return Value

The handle to a tree-view item (HTREEITEM) that corresponds to the uAccId parameter. For more information, see the hItem member of the TVITEMEX structure.

Remarks

Accessibility aids are applications that help people with disabilities use computers. An accessibility identifier is used by the IAccessible interface to uniquely specify an element in a window. For more information about accessibility identifiers, search for the "About Active Accessibility Support" topic at Microsoft Developer Network.

This method sends the TVM_MAPACCIDTOHTREEITEM message, which is described in the Windows SDK.

Requirements

Header: afxcmn.h

This method is supported in Windows XP and later.

Additional requirements for this method are described in Build Requirements for Windows Vista Common Controls.

Example

The following code example defines a variable, m_treeCtrl, that is used to access the current tree-view control. The code example also defines an unsigned integer and several HTREEITEM variables. These variables are used in the next example.

public:
    // Variable to access tree control.
    CTreeCtrl m_treeCtrl;
    // Variable to access splitbutton control.
    CSplitButton m_splitbutton;
    // Accessibility identifier
    UINT accIdUS;
    // HTREEITEMs
    HTREEITEM hCountry;
    HTREEITEM hPA;
    HTREEITEM hWA;

The following code example uses an accessibility identifier and the CTreeCtrl::MapAccIdToItem method to retrieve a handle to the root tree-view item. The example uses the handle and the CTreeCtrl::GetItemPartRect method to draw a 3D rectangle around that item. In an earlier section of the code example, which is not shown, we created a tree-view that consists of a root country node for the United States, subnodes for the states of Pennsylvania and Washington, and tree items for cities in those states. We used the CTreeCtrl::MapItemToAccID method to associate the root tree-view item with an accessibility identifier.

    CRect rect;
    HTREEITEM hUS = m_treeCtrl.MapAccIdToItem( accIdUS );
    m_treeCtrl.GetItemPartRect( hUS, TVGIPR_BUTTON, &rect );
    m_treeCtrl.GetDC()->Draw3dRect( &rect, RGB(255, 0, 0), RGB(0, 0, 255));

See Also

Reference

CTreeCtrl Class

Hierarchy Chart

TVM_MAPACCIDTOHTREEITEM

TVITEMEX

CTreeCtrl::MapItemToAccID

Other Resources

CTreeCtrl Members