Maps the ID of an item to an index.



The unique ID of an item.


Must be zero.

Return value

Returns the most current index.


List-view controls internally track 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. You can use this ID to guarantee uniqueness during the lifetime 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.

If you need the index of an item after an ID is created you can call LVM_MAPIDTOINDEX with the unique ID and it returns the most current index.

LVM_MAPIDTOINDEX is not supported under the LVS_OWNERDATA style.

Note  In a multithreaded environment, the index is only guaranteed on the thread that hosts the list-view control, not on background threads.
Note  To use this message, you must provide a manifest specifying Comclt32.dll version 6.0. For more information on manifests, see Enabling Visual Styles.


Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]