0x90
0x90

Reputation: 293

SendMessage lParam empty

I am trying to store a value in the lParam of a LV_ITEM:

;...
mov eax, value
mov lvi.lParam, eax
invoke SendMessage, hList, LVM_INSERTITEM, 0 addr lvi

lvi is a (LOCAL) LV_ITEM, and hList is the handle of my ListView Control. If this item is now clicked, i try to read it's value:

invoke SendMessage,hList,LVM_GETNEXTITEM,-1,LVNI_FOCUSED
mov lvi.iItem, eax
mov lvi.iSubItem, 0
mov lvi.imask, LVIF_TEXT
mov lvi.cchTextMax,256
invoke SendMessage,hList,LVM_GETITEM, 0, addr lvi

Again lvi is a (LOCAL) LV_ITEM, and hList the handle of the ListView. Now I can read e.g. the pszText (lvi.pszText), but the lParam is always zero. Last Error also returns zero.

Any help is appreciated

Upvotes: 1

Views: 842

Answers (1)

Sparafusile
Sparafusile

Reputation: 4956

Did you set the iMask of the LV_ITEM to LVIF_TEXT+LVIF_PARAM? If not, the lParam in the LV_ITEM structure is ignored.

;...
mov lvi.iMask, LVIF_TEXT+LVIF_PARAM
push value
pop lvi.lParam
invoke SendMessage, hList, LVM_INSERTITEM, 0 addr lvi

You will also need to request it in the same way:

invoke SendMessage,hList,LVM_GETNEXTITEM,-1,LVNI_FOCUSED
mov lvi.iItem, eax
mov lvi.iSubItem, 0
mov lvi.imask, LVIF_TEXT+LVIF_PARAM
mov lvi.cchTextMax,256
invoke SendMessage,hList,LVM_GETITEM, 0, addr lvi 

Upvotes: 1

Related Questions