DEF CreateCompatibleBitmap(3) !"GDI32","CreateCompatibleBitmap"
Proc CaptureWindow
Parameters handle&
External("USER32","SetForegroundWindow",handle&)
Sleep 200
External("USER32","keybd_event",$2C,0,0,0)
Case handle&<>0 : External("USER32","keybd_event",$2C,1,0,0)
MCLS %maxX,%maxY
StartPaint -1
ClipLoadBmp 0,0;0
ClearClip
EndPaint
Var hpic&=Create("hNewPic", %BmpX, %BmpY, 0)
StartPaint hpic&
MCopyBmp 0,0-%maxX,%maxY > 0,0;0
EndPaint
Return hpic&
EndProc
Proc CaptureArea
Parameters xpos%,ypos%,maxX!,maxY!
Var hdc& = External("USER32","GetDC",0)
Var hmdc& = External("GDI32","CreateCompatibleDC",hdc&)
Var hbitmap& = CreateCompatibleBitmap(hdc&,int(maxX!),int(maxY!))
External("GDI32","SelectObject",hmdc&, hbitmap&)
External("GDI32","BitBlt",hmdc&, 0, 0, int(maxX!), int(maxY!), hdc&, xpos%, ypos%, $0CC0020)
hbitmap& = External("GDI32","GetCurrentObject",hmdc&, 7)
External("GDI32","DeleteDC",hmdc&)
External("USER32","ReleaseDC",0,hdc&)
Return hbitmap&
EndProc
Cls
DrawSizedPic CaptureWindow(0), 0, 0 - width(%hwnd), height(%hwnd); 0'Ganzer Bildschirn
Waitinput
DrawSizedPic CaptureWindow(%hwnd), 0, 0 - width(%hwnd), height(%hwnd); 0'Fenster
Waitinput
DrawSizedPic CaptureArea(0,0,width(%hwnd),height(%hwnd)), 0, 0 - width(%hwnd), height(%hwnd); 0'Region
Waitinput