Basic Univers
; Idea from Rikuk
; File specifies the file where icon is extracted
; icon = 0 to ? --> Return handle of image
; icon = -1 --> Return the count of icon

Procedure IconExtract(File.s, Icon.l)
  ProcedureReturn ExtractIcon_(0, File, Icon)
EndProcedure

;/ Test
#file = "F:\WINDOWS\explorer.exe"
Count = IconExtract(#file, - 1)
OpenWindow(0, 0, 0, 130, 70, #PB_Window_SystemMenu|#PB_Window_ScreenCentered, Str(Count)+" Icons")
CreateGadgetList(WindowID(0))
ButtonImageGadget(0, 10, 10, 48, 48, IconExtract(#file, pointer))
TextGadget(1, 80, 30, 40, 20, "n° 1")


Repeat
  event = WaitWindowEvent()
 
  If event = #PB_Event_Gadget And EventGadgetID()= 0 And EventType()=#PB_EventType_LeftClick
    pointer + 1
    If pointer = Count : pointer = 0 : EndIf
    SetGadgetState(0, IconExtract(#file, pointer))
    SetGadgetText(1, "n° " + Str(pointer + 1))
  EndIf
Until event =#PB_Event_CloseWindow