Shell32.dll: Icons darstellen und drucken
Verfasst: 18.05.2009 14:13
Hi, mit dem folgenden Code kann ich die Icons aus der shell32.dll darstellen. Leider funktioniert das Ausdrucken nicht. Hat jemand eine Idee, woran das liegen könnte? Und dann habe ich noch eine Frage: Kann man Icons, die man sich mit der ExtractIcon-Funktion holt, auch abspeichern?
Code: Alles auswählen
#window = 0
#button = 555
kmax = 30 ;(die ersten 30 Icons aus shell32.dll)
OpenWindow(#window, 0 , 0 , 700 , 460 , "Icons" , #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
scroll_y = (kmax/4) * 70
ScrollAreaGadget(#PB_Any, 10, 25, 680, 430, 648, scroll_y, 100)
ButtonGadget(#button, 590, scroll_y-20, 50, 20, "Drucken")
For k = 0 To kmax
x_pos = 30 + 100*(k%6)
y_pos = 20 + 100*(k/6)
hIcon.l = 0
ExtractIconEx_("shell32.dll",k,@hIcon,0,1)
ImageGadget(k, x_pos, y_pos, 32, 32, hIcon, 0)
TextGadget(#PB_Any, x_pos + 7, y_pos +40, 20, 20, Str(k))
Next
Repeat
event = WaitWindowEvent()
If Event = #PB_Event_Gadget
If EventGadget()=#button
If PrintRequester()
If StartPrinting("Icon-Druck")
LoadFont(0, "Arial",44)
If StartDrawing(PrinterOutput())
For k = 0 To kmax
;nach 20 Bildern neue Seite anfangen
If k%20 = 0 And k>0
NewPrinterPage()
EndIf
x_pos = 500 + 24*45*(k%4)
y_pos = 200 + 24*55*((k/4) - 5*(k/20))
ExtractIconEx_("shell32.dll",k,@hIcon,0,1)
DrawImage(hIcon, x_pos, y_pos , 1000, 1000)
DrawingFont(FontID(0))
DrawText(x_pos, y_pos + 520, Str(k))
Next
StopDrawing()
EndIf
StopPrinting()
EndIf
EndIf
EndIf
EndIf
Until WaitWindowEvent() = #PB_Event_CloseWindow