Restored from previous forum. Originally posted by Justin.
How can i display the associated icons of the list icon items?
I mean, if i populate a list icon with filenames with extensions how to use the icons associated with the extension, just like the explorer does.
Listicon showing associated icons
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Justin.
Well, i figured it out. Note that the file doesn't actually have to exist.
;show associated file icons in listicon
fileinfo.SHFILEINFO
DummyFileName$="foo.zip"
;get icon handle
SHGetFileInfo_(DummyFileName$,#FILE_ATTRIBUTE_NORMAL,@fileinfo,SizeOf(SHFILEINFO),#SHGFI_ICON|#SHGFI_USEFILEATTRIBUTES)
hic=fileinfo\hIcon
hWnd=OpenWindow(0,10,10,300,200,#PB_Window_SystemMenu,"Default icon:")
CreateGadgetList(hWnd)
ListIconGadget(1,10,10,280,180,"",100,#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
AddGadgetItem(1,0,DummyFileName$,hic)
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
it's just a port of a C code i founded:
http://msdn.microsoft.com/code/default. ... pe_cpp.asp
Well, i figured it out. Note that the file doesn't actually have to exist.
;show associated file icons in listicon
fileinfo.SHFILEINFO
DummyFileName$="foo.zip"
;get icon handle
SHGetFileInfo_(DummyFileName$,#FILE_ATTRIBUTE_NORMAL,@fileinfo,SizeOf(SHFILEINFO),#SHGFI_ICON|#SHGFI_USEFILEATTRIBUTES)
hic=fileinfo\hIcon
hWnd=OpenWindow(0,10,10,300,200,#PB_Window_SystemMenu,"Default icon:")
CreateGadgetList(hWnd)
ListIconGadget(1,10,10,280,180,"",100,#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect)
AddGadgetItem(1,0,DummyFileName$,hic)
Repeat
Until WaitWindowEvent()=#PB_Event_CloseWindow
it's just a port of a C code i founded:
http://msdn.microsoft.com/code/default. ... pe_cpp.asp