Date: 02-16-2022
Return to Index
created by gbSnippets
#Compile Exe ' IconView.bas
#Dim All
#Include "WIN32API.INC"
%ID_LIST = 200
'====================================================================
Function PBMain () As Long
Local hDlg, hIcon As Dword
Local c, cIcons, dataValue, iItem As Long
Dialog New 0, "imageres icons",,, 600, 400, %WS_OverlappedWindow, 0 To hDlg
Control Add ListView, hDlg, %ID_LIST, "SysListView321", 5, 5, 1200,1000, _
%WS_Child Or %WS_Visible Or %WS_VScroll Or %WS_TabStop, %WS_Ex_ClientEdge
ImageList New Icon 32, 32, %ILC_COLOR32, 0 To dataValue
ListView Set ImageList hDlg, %ID_LIST, dataValue, %LVSIL_NORMAL
'------------------------------------------------------------------
cIcons = ExtractIcon(0, "imageres.dll", -1) '-1 = icon count can try ImageRes.dll too
For c = 0 To cIcons - 1
hIcon = ExtractIcon(0, "imageres.dll", c) ' ImageRes.dll
If hIcon Then
Incr iItem
ImageList Add Icon dataValue, hIcon
ImageList Get Count dataValue To cIcons
ListView Insert Item hDlg, %ID_LIST, iItem, cIcons, "Icon" + Str$(c)
End If
Next
'------------------------------------------------------------------
Dialog Show Modal hDlg
End Function
http://www.garybeene.com/sw/gbsnippets.htm