Hey there..
Danilo was kind enough to give us some nice code to display the icons from dll's and exe's in a chosen directory...
(double-click to save as .bmp
* edited so user can choose directory
Code: Select all
; by Danilo, 30.03.2004 (for blueznl, engl. chat)
;
; lists Windows system icons
; (double click to save as .bmp)
NewList IconHandles()
OpenWindow(0, 0, 0, 500, 500, "System Icons (double click to save icon as .bmp)",
#PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListIconGadget(0, 0, 0, 500, 500, "", 500)
SetGadgetAttribute(0, #PB_ListIcon_DisplayMode, #PB_ListIcon_LargeIcon)
winDir$ = Space(2001)
GetSystemDirectory_(winDir$, 2000)
winDir$ = PathRequester("choose directory to examine", winDir$)
If winDir$
Restore Patterns
For a = 1 To 2
Read.s a$
ExamineDirectory(1, winDir$, a$)
Repeat
entry = NextDirectoryEntry(1)
If entry = 1
x = 0
Repeat
fileName$ = DirectoryEntryName(1)
hIcon = ExtractIcon_(GetModuleHandle_(0), fileName$, x)
x + 1
If hIcon
iconCount + 1
AddElement(IconHandles())
IconHandles() = hIcon
AddGadgetItem(0, -1, fileName$ + " , " + Str(x), hIcon)
While WindowEvent() : Wend
EndIf
Until hIcon = 0
EndIf
Until entry = 0
Next a
MessageRequester("INFO", "Found " + Str(iconCount) +
" icons.", #MB_ICONINFORMATION)
If iconCount
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = #True
Case #PB_Event_Gadget
Select EventGadget()
Case 0
If EventType() = #PB_EventType_LeftDoubleClick
pos = GetGadgetState(0)
SelectElement(IconHandles(), pos)
CreateImage(1, 32, 32)
If StartDrawing(ImageOutput(1))
Box(0, 0, 32, 32, GetSysColor_(#COLOR_BTNFACE))
DrawImage(IconHandles(), 0, 0, 32, 32)
StopDrawing()
save$ = SaveFileRequester("SAVE",
ReplaceString(GetGadgetItemText(0, pos, 0),
".", "_") + ".bmp", "Windows Bitmap | *.bmp", 0)
If save$
If GetExtensionPart(save$) <> "bmp"
save$ + ".bmp"
EndIf
SaveImage(1, save$)
EndIf
EndIf
EndIf
EndSelect
EndSelect
Until Quit
ForEach IconHandles()
DestroyIcon_(IconHandles())
Next
EndIf
EndIf
CloseWindow(0)
DataSection
Patterns:
Data.s "*.dll", "*.exe"
EndDataSection