Just a little snippet, wich might be usefull for someone:



; subclass you listview and call this proc via SetWindowLong
ListProc proc hCtl :DWORD, uMsg :DWORD, wParam :DWORD, lParam :DWORD

.if uMsg == WM_KEYDOWN
.if wParam == VK_DELETE
@@:
invoke SendMessage, hCtl, LVM_GETSELECTEDCOUNT, 0, 0
or eax, eax
je @F
invoke SendMessage, hCtl, LVM_GETNEXTITEM, -1, LVNI_SELECTED
invoke SendMessage, hCtl, LVM_DELETEITEM, eax, 0
jmp @B
@@:
.endif
.endif

invoke CallWindowProc, lpListProc, hCtl, uMsg, wParam, lParam

ret

ListProc endp
Posted on 2001-09-30 01:16:52 by bazik
I hate to point this out since you've done all this work, but invoke SendMessage,lWnd,LB_RESETCONTENT,0,0 will do this as well.
Posted on 2001-09-30 04:24:11 by Eóin
No, Eoin, since baziks code deletes only selected items, yours deletes all (and is a message for a listbox, not a listview). Of course I hated to point that out too :grin: .

japheth
Posted on 2001-09-30 07:33:52 by japheth
; subclass you listview and call this proc via SetWindowLong

ListProc proc hCtl :DWORD, uMsg :DWORD, wParam :DWORD, lParam :DWORD

.if uMsg == WM_KEYDOWN
.if wParam == VK_DELETE
; @@:
; invoke SendMessage, hCtl, LVM_GETSELECTEDCOUNT, 0, 0
; or eax, eax

mov esi, hCtl
jmp @F
@@:
invoke SendMessage, esi, LVM_DELETEITEM, eax, 0
@@:
invoke SendMessage, esi, LVM_GETNEXTITEM, -1, LVNI_SELECTED
cmp eax, -1
jne @B
.endif
.endif

invoke CallWindowProc, lpListProc, hCtl, uMsg, wParam, lParam
Posted on 2001-09-30 13:08:40 by buliaNaza