ListView_MapIndexToID macro (commctrl.h)

Maps the index of an item to a unique ID. You can use this macro or send the LVM_MAPINDEXTOID message explicitly.

Syntax

UINT ListView_MapIndexToID(
   HWND hwnd,
   UINT index
);

Parameters

hwnd

Type: HWND

A handle to the list-view control.

index

Type: UINT

A UINT that contains the index of an item.

Return value

Type: UINT

Returns a unique ID.

Remarks

List-view controls internally track items by index. This can present problems because indexes can change during the control's existence.

You can use this macro to tag an item with an ID when you create the item. You use this ID to guarantee uniqueness during the existence of the list-view control.

To uniquely identify an item, take the index that is returned from a call such as IComponent::GetDisplayInfo and call LVM_MAPINDEXTOID. The return value is a unique ID.

Note  In a multithreaded environment, you can only be sure the correct index is returned on the thread that hosts the list-view control, not on background threads.
 
To use ListView_MapIndexToID, specify Comctl32.dll version 6 in the manifest. For more information on manifests, see Enabling Visual Styles.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header commctrl.h