Muokkaa

Jaa


LVM_SORTITEMSEX message

Uses an application-defined comparison function to sort the items of a list-view control. The index of each item changes to reflect the new sequence. You can send this message explicitly or by using the ListView_SortItemsEx macro.

Parameters

wParam

Application-defined value that is passed to the comparison function.

lParam

Pointer to an application-defined comparison function. It is called during the sort operation each time the relative order of two list items needs to be compared.

Return value

Returns TRUE if successful, or FALSE otherwise.

Remarks

The comparison function has the following form:

int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);  

This message is similar to LVM_SORTITEMS, except for the type of information passed to the comparison function. With LVM_SORTITEMSEX, lParam1 is the current index of the first item, and lParam2 is the current index of the second item. You can send an LVM_GETITEMTEXT message to retrieve more information on an item, if needed.

The comparison function must return a negative value if the first item should precede the second, a positive value if the first item should follow the second, or zero if the two items are equivalent.

Note

During the sorting process, the list-view contents are unstable. If the callback function sends any messages to the list-view control aside from LVM_GETITEM (ListView_GetItem), the results are unpredictable.

Requirements

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