I have a ListView where I need to perform operations on multiple selected rows. I start cycling through the selected rows using ListView_GetNextItem(hLV, -1, LVNI_SELECTED | LVNI_PREVIOUS). However when debugging, the index of the first selected row is returned, not the last. This is the same when only the LVNI_PREVIOUS flag is used.
The MS documentation states:
Windows Vista and later: Searches for an item that is ordered before the item specified in wParam. The LVNI_PREVIOUS flag is not directional (LVNI_ABOVE will find the item positioned above, while LVNI_PREVIOUS will find the item ordered before.) The LVNI_PREVIOUS flag basically reverses the logic of the search performed by the LVM_GETNEXTITEM or LVM_GETNEXTITEMINDEX messages.
Why would LVNI_PREVIOUS not work in the manner described? Could it be that I'm using the wrong commctrl version, as it does say Vista and above only?
Any help would be appreciated, thanks.