Skip to content

Commit

Permalink
Fix issue #35
Browse files Browse the repository at this point in the history
  • Loading branch information
artem78 committed Jun 9, 2023
1 parent 6edfe70 commit a33d27d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions screengrabber.pas
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,17 @@ procedure TScreenGrabber.CaptureRegion(AFileName: String; ARect: TRect);
//Bitmap.TakeScreenshot(Rect); // Not supports multiply monitors
ScreenDC := GetDC(HWND_DESKTOP); // Get DC for all monitors
DebugLn('ScreenDC=', DbgS(ScreenDC));
{BitBlt(Bitmap.Canvas.Handle, 0, 0, ARect.Width, ARect.Height,
ScreenDC, ARect.Left, ARect.Top, SRCCOPY);}
{$IfDef Windows}
// https://github.com/artem78/AutoScreenshot/issues/35
// and https://github.com/bgrabitmap/bgrabitmap/issues/200
BitBlt(Bitmap.Canvas.Handle, 0, 0, ARect.Width, ARect.Height,
ScreenDC, ARect.Left, ARect.Top, SRCCOPY);
{$EndIf}
{$IfDef Linux}
// ToDo: Check bug #35 in Linux
Bitmap.LoadFromDevice(ScreenDC, ARect);
{$EndIf}

ReleaseDC(0, ScreenDC);

case ImageFormat of
Expand Down

0 comments on commit a33d27d

Please sign in to comment.