Catch ICON's from DLLs and use in own Gadgets

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Catch ICON's from DLLs and use in own Gadgets

Post by BackupUser »

Code updated For 5.20+

Restored from previous forum. Originally posted by Rings.

Code is 80% from german 'PCFreak'

Code: Select all

SSystemPath.s=Space(255)
Result=GetSystemDirectory_(SystemPath.s,255)
OpenWindow(0,0,0,237,50,"Icon-Test",#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
If CreateGadgetList(WindowID(0))
  For a=0 To 5
    ButtonImageGadget(a,10+a*36,10,36,36,ExtractIcon_(0,SystemPath+"\SetupAPI.dll",a))
  Next
EndIf
Repeat : Until WindowEvent()=#PB_Event_CloseWindow
End
Its a long way to the top if you wanna .....CodeGuru
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by MrVainSCL.

Very nice example Rings!
Here is an example showing all available icons of the DLL rings used in his example... Original code by Rings.

Code: Select all

SystemPath.s=Space(255)
Result=GetSystemdirectory_(SystemPath.s,255)
OpenWindow(0,0,0,800,150,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered,"Icon-Test")
If CreateGadgetList(WindowID())
 For a=0 To 19
  ButtonImageGadget(a,10+a*36,10,36,36,ExtractIcon_(0,SystemPath+"\SetupAPI.dll",a))
  ButtonImageGadget(a,10+a*36,50,36,36,ExtractIcon_(0,SystemPath+"\SetupAPI.dll",a+19))
 Next
EndIf
Repeat : Until WindowEvent()=#PB_EventCloseWindow
End

PIII450, 256MB Ram, 80GB HD + 6,4 GB, RivaTNT, DirectX8.1, SB AWE64, Win2000 + all Updates...

greetz
MrVainSCL! aka Thorsten
Post Reply