#include once "window9.bi"

Function ReplaceImageListView(ByVal gadget As long, _
                                ByVal iItem As Integer, _
                                ByVal iSubItem As Integer, _
                                ByVal Image As HBITMAP) As Integer Export
   
    Dim LV_ITEM_ As LV_ITEM
    LV_ITEM_.mask=LVIF_IMAGE
    LV_ITEM_.iItem = iItem
    LV_ITEM_.iSubItem = iSubItem
    SendMessage(gadgetid(gadget),LVM_GETITEM,0,Cast(lparam,@LV_ITEM_))
    function = ImageList_Replace(Cast(HIMAGELIST,GetHimageCombo_(gadget)),LV_ITEM_.iImage ,Image ,0)
    SendMessage(GadgetID(gadget),LVM_UPDATE,LV_ITEM_.iImage ,0)
	for i as Long = 0 to 3
	    InvalidateRect(GadgetID(gadget),0,1)
	Next
End Function
