question

NorthernSun-8235 avatar image
0 Votes"
NorthernSun-8235 asked Castorix31 answered

[Win32][C++] Looking to receive new item index after LVM_SORTITEMSEX

I am looking to get the definitive new index of an item when LVM_SORTITEMSEX completed its job. I'd like to get some notification like LVN_ITEMINDEXCHANGED(int indexOld, int indexNew).

I don't think windows lets you know such information in the form of a notification right? I have noticed that none of the LVN_INSERT/LVN_DELETE/LVN_ITEMCHANGING/LVN_ITEMCHANGED gets received while Windows sorts the items so I guess that won't be of any help.

I guess I might have to keep track of the index changes myself in the compare function?

windows-apic++
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Viorel-1 avatar image
1 Vote"
Viorel-1 answered

If you used the LVITEM structure to add the items, then you can use the lParam field to store a value (a number or pointer) that is specific to each item. Then for example you can use the LVM_FINDITEM message to find the item by lParam and get its index.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Castorix31 avatar image
0 Votes"
Castorix31 answered

> I don't think windows lets you know such information in the form of a notification right?

The Listview sends EVENT_OBJECT_REORDER


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.