News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

ListView images

Started by msmith, February 13, 2006, 05:18:22 AM

Previous topic - Next topic

msmith

I am trying to set the first item icon in a listview. The listview has 4 items, and the following code is causing all 4 of them to be set to the icon. Also all 4 icons have a black background for some unknown reason. The listview is in report mode.


; LN:16 create il,icon1
invoke ImageListCreate,16,16,ILC_COLOR,1,1
mov [il],eax
invoke ImageListAddIcon,[il],[icon1]
.
.
.
; LN:24 lv.setimage 1,il,1
mov edi,!lv; get descriptor addr
mov eax,1; 1 based item index
dec eax; adjust for 0 based
mov [!LV_ItemiItem],eax; put into struct
mov [!LV_Itemmask],LVIF_IMAGE; set mask
invoke SendMessage, dword [edi+HandleOffs],LVM_SETIMAGELIST,LVSIL_SMALL,[il]; set imagelist of listview
mov eax,1; 1 based imagelist index
dec eax; adjust for 0 based
mov [!LV_ItemiImage],eax; put into struct
invoke SendMessage, dword [edi+HandleOffs],LVM_SETITEM,0,!LV_Itemmask