共用方式為


CTreeCtrl::MapItemToAccID

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

UINT MapItemToAccID(
     HTREEITEM hItem
) const;

Parameters

Parameter

Description

[in] hItem

A handle of a tree-view item in the control. For more information, see the hItem member of the TVITEMEX structure.

Return Value

The accessibility identifier that corresponds to the hItem parameter.

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_MAPHTREEITEMTOACCID 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 obtains an identification number for a tree-view control item. In an earlier section of the code example, which is not shown, we created a tree-view that consists of a root country/region node for the United States, subnodes for the states of Pennsylvania and Washington, and tree items for cities in those states. This code example obtains a unique identification number for the root country/region node.

// Map an accessibility identifier to the Pennsylvania node.
    accIdUS = m_treeCtrl.MapItemToAccId( hCountry );

See Also

Reference

CTreeCtrl Class

Hierarchy Chart

TVM_MAPHTREEITEMTOACCID

TVITEMEX

CTreeCtrl::MapAccIdToItem