开发者

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


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 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜