问题描述
我试图存储在LV_ITEM的lParam的值:
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是(本地)LV_ITEM和hList是我的ListView控件的句柄。如果此项目现在点击,我尽量读它的值:
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
同样LVI是(本地)LV_ITEM和hList ListView控件的句柄。
现在我可以阅读例如所述pszText(lvi.pszText),但lParam为始终为零。最后一次错误也返回零。
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.
任何帮助是pciated AP $ P $
Any help is appreciated
推荐答案
你的 LV_ITEM
的IMASK设置为 LVIF_TEXT + LVIF_PARAM
?如果没有,在 LV_ITEM
结构lParam的将被忽略。
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
这篇关于SendMessage函数lParam的空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!