Yeah that crashes on my machine too.
Here, try the original script with out all the class and volatile geegaw type stuff.
'======================================================
' Shell32 Icon Index FBSL
' Cpilot 11/04/05
' http://outcastprogramming.com/
'======================================================
'$apptype console
#dlldeclare user32("GetSystemMetrics","DestroyIcon")
#dlldeclare comctl32("ImageList_Create","ImageList_ReplaceIcon")
#dlldeclare shell32("ExtractIcon")
dim $LV_ITEM,%hList,%t,%hIcon,%hImage,$index,%j
begin const
ILC_COLOR32 = 32
ILC_MASK = &H1
LVSIL_SMALL = 1
LVSIL_STATE = 2
LVS_LIST = 0x0003
LVIF_TEXT = 0x1
LVIF_IMAGE = &H2
LVS_REPORT = 0x0001
LVS_TYPEMASK = 0x3
LVS_EX_GRIDLINES = &H1
LVS_EX_LABELTIP = 0x00004000
LVIS_STATEIMAGEMASK = &HF000
SM_CXICON = 11
SM_CYICON = 12
'=======VB struct ================
'Public Type LV_ITEM
mask = 0
iItem = 4
iSubItem = 8
state = 12
stateMask = 16
pszText = 20
cchTextMax = 24
iImage = 28
' lParam 32
' iIndent 36
'End Type
end const
fbsl_settext(me,"Shell32 Icon Index")
alloc(LV_ITEM,36)
SetMem(LV_ITEM,LVIF_TEXT + LVIS_STATEIMAGEMASK + LVIF_IMAGE,mask) ' set state masks
SetMem(LV_ITEM,256,cchTextMax)
Resize(me,0,0,510,330)
center(me)
show( me )
hList = fbsl_control("SysListView32",me,"",0,0,0,500,294,_
WS_VISIBLE + WS_CHILD + LVS_LIST + LVS_TYPEMASK + LVS_REPORT,WS_EX_STATICEDGE)
SendMessage(hList,LVM_SETBKCOLOR,0,rgb(255,255,192))
SendMessage(hList,LVM_SETTEXTBKCOLOR,0,rgb(255,255,192))
SendMessage(hList,LVM_SETEXTENDEDLISTVIEWSTYLE,0,LVS_EX_LABELTIP)
'==========create an image list======================
hImage = ImageList_Create(GetSystemMetrics(SM_CXICON),_
GetSystemMetrics(SM_CYICON),ILC_COLOR32 + ILC_MASK,1,1)
'====================================================
'====Extract the icon then destroy the handle to
' replace with next icon========================
for t = 0 to 237
'shell32.dll
'c:\program files\outlook express\msimn.exe
'c:\program files\outlook express\msoeres.dll
hIcon = ExtractIcon(0,"shell32.dll",t)
ImageList_ReplaceIcon(hImage,-1,hIcon)
DestroyIcon(hIcon)
if hIcon <> 0 then
j = t
end if
next
'=====set the image list to the listview=========
SendMessage(hList,LVM_SETIMAGELIST,LVSIL_SMALL,hImage)
'================================================
'=====populate the listview======================
for t = 0 to j
index = "Icon # : " & t
SetMem(LV_ITEM,t,iItem) ' item index
SetMem(LV_ITEM,@index,pszText) ' pointer to text string
SetMem(LV_ITEM,t,iImage) ' image index
SendMessage(hList,LVM_INSERTITEM,0,LV_ITEM)
next
begin events
select case cbmsg
case wm_close
exitprogram(0)
end select
end events
Works fine on my WinXP Sp2.