ListView_MapIDToIndex macro (commctrl.h)
Maps the ID of an item to an index. You can use this macro or send the LVM_MAPIDTOINDEX message explicitly.
UINT ListView_MapIDToIndex(
HWND hwnd,
UINT id
);
hwnd
Type: HWND
A handle to the list-view control.
id
Type: UINT
A UINT that contains the unique ID of an item.
Type: UINT
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 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 returns from a call, such as IComponent::GetDisplayInfo, and call LVM_MAPINDEXTOID. The return value is a unique ID.
If you need to know the index of an item after creating an ID, call LVM_MAPIDTOINDEX with the unique ID and it returns the most current index.
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 |