Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compile Exe
#Dim All
#Include "win32api.inc"
#Resource Icon zero "0.ico"
#Resource Icon five "5.ico"
Global hDlg,hLst1,hListView As Dword 'main dialog handle
Function PBMain() As Long
Dialog New Pixels, 0, "ListView Test",300,300,200,150,%WS_OverlappedWindow To hDlg
Control Add Button, hDlg, 200, "Get Index", 10,10,70,22
Control Add ListView, hDlg, 100, "", 10,50,175,80
Control Handle hDlg, 100 To hListview
ImageList New Icon 16,16,32,3 To hLst1
ImageList Add Icon hLst1, "zero"
ImageList Add Icon hLst1, "five"
ListView Set ImageList hDlg, 100, hLst1, %lvsil_small
ListView Insert Column hDlg, 100, 1, "test1", 75, 0
ListView Insert Item hDlg, 100, 1, 1, "zero"
ListView Insert Item hDlg, 100, 2, 2, "five"
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
If Cb.Msg = %WM_Command And Cb.Ctl = 200 Then
Local itemLV As LV_ITEM, i As Long
itemLV.iItem = 0 '<----- first row
itemLV.mask = %LVIF_Image
itemLV.statemask = %LVIF_Image
SendMessage hListView, %LVM_GetItem, 0, VarPtr(itemLV)
? Str$(itemLV.iImage)
itemLV.iItem = 1 '<----- second row
itemLV.mask = %LVIF_Image
itemLV.statemask = %LVIF_Image
SendMessage hListView, %LVM_GetItem, 0, VarPtr(itemLV)
? Str$(itemLV.iImage)
End If
End Function
'gbs_01242
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm