CListCtrl::MapIDToIndex

Maps the unique ID of an item in the current list-view control to an index.

UINT MapIDToIndex(
     UINT id
) const;

Parameters

Parameter

Description

[in] id

The unique ID of an item.

Return Value

The current index for the specified ID.

Remarks

A list-view control internally tracks items by index. This can present problems because indexes can change during the control's lifetime. The list-view control can tag an item with an ID when the item is created and you can use this ID to guarantee uniqueness during the lifetime of the list-view control.

Note that in a multithreaded environment the index is guaranteed only on the thread that hosts the list-view control, not on background threads.

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

Requirements

Header: afxcmn.h

This control is supported in Windows XP and later.

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

See Also

Concepts

CListCtrl Class

CListCtrl Members

Hierarchy Chart

LVM_MAPIDTOINDEX

CListCtrl::MapIndexToID