I need to make something like List View in Kaza or like in eMule thet when i click on the header of a column all columns are sorted.
LVM_SORTITEMS, you also need comparison procedure, that could just simply call lstrcmp.
can i use this stuff to sort by subitems ????
Use LVM_SORTITEMSEX, it send the item indexes in the parameters so you can use it for the subitem number: (Code is thrown together pretty quickly so excuse the sloppiness)
SORDER is true or false (Ascending or Descending)
is the column number to be sorted.
SORDER is true or false (Ascending or Descending)
invoke SendMessage,LVHANDLE,LVM_SORTITEMSEX,SORDER,ADDR LVCompareFunc
LVCompareFunc proc lParam1:DWORD,lParam2:DWORD,lParamSort:DWORD
LOCAL TBUFFER1[256] :BYTE
LOCAL TBUFFER2[256] :BYTE
LOCAL ItemData :LV_ITEM
mov eax,lParam1
mov ItemData.iItem,eax
mov eax,LVSORTCOLUMN
mov ItemData.iSubItem,eax
lea eax,TBUFFER1
mov ItemData.pszText,eax
mov ItemData.cchTextMax,255
mov ItemData.imask,LVIF_TEXT
invoke SendMessage,LVHANDLE,LVM_GETITEM,0,ADDR ItemData
mov eax,lParam2
mov ItemData.iItem,eax
mov eax,LVSORTCOLUMN
mov ItemData.iSubItem,eax
lea eax,TBUFFER2
mov ItemData.pszText,eax
mov ItemData.cchTextMax,255
mov ItemData.imask,LVIF_TEXT
invoke SendMessage,LVHANDLE,LVM_GETITEM,0,ADDR ItemData
invoke lstrcmp,ADDR TBUFFER1,ADDR TBUFFER2
.IF lParamSort == FALSE
neg eax
.ENDIF
ret
LVCompareFunc endp
EDIT: cleaned it up a bit. BTW LVSORTCOLUMN
is the column number to be sorted.
Wow, I didn't know you could sort items by gender.
Also to get the column number from a header click process the LVN_COLUMNCLICK notification:
.ELSEIF uMsg == WM_NOTIFY
mov edx, lParam
.IF [edx].NMHDR.code == LVN_COLUMNCLICK
push [edx].NM_LISTVIEW.iSubItem
pop LVSORTCOLUMN
.ENDIF
etc...
Wow, I didn't know you could sort items by gender.
I don't think LVM_SORTITEMSEX is in Windows.inc, here it is just in case:
LVM_SORTITEMSEX equ LVM_FIRST + 81
This seems to be missing as well...
LVS_EX_BORDERSELECT equ 16384
LVM_SORTITEMSEX equ LVM_FIRST + 81
This seems to be missing as well...
LVS_EX_BORDERSELECT equ 16384