GrabDrawingImage()
Posted: Sat Dec 15, 2012 2:45 pm
I know how to capture an image using Windows API, but I thought I'd try GrabDrawingImage() as it is cross-platform:
Result is a blank image?
Code: Select all
UsePNGImageEncoder()
Enumeration
#Wn
#Image
EndEnumeration
If OpenWindow(#Wn,0,0,200,200,"Win",#PB_Window_SystemMenu|#PB_Window_TitleBar|#PB_Window_ScreenCentered)
SetWindowColor(#Wn,RGB(0,96,96))
If StartDrawing(WindowOutput(#Wn))
;CreateImage(#Image, 200, 200, 24)
GrabDrawingImage(#Image, 0, 0, 200, 200)
StopDrawing()
SaveImage(#Image, "C:\Image.png", #PB_ImagePlugin_PNG)
EndIf
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
End