Recent

Author Topic: Screen Capture Without Lazarus App Showing in Screen Capture  (Read 431 times)

Possum

  • Jr. Member
  • **
  • Posts: 69
    • uDoPage
Screen Capture Without Lazarus App Showing in Screen Capture
« on: August 19, 2020, 02:41:40 am »
Hi

I really have looked hi and low but no answer found so here I am.

I want to do a screen capture that does not include my Lazarus (linux) app.. But the app keeps on getting included in image...

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3. ScreenDC: HDC;
  4. MyRec : TRect;
  5. LocalBitmap : Tbitmap;
  6. begin
  7.   form1.Visible:=false;
  8.   LocalBitmap := TBitmap.Create;
  9.   ScreenDC := GetDC(1);
  10.   LocalBitmap.LoadFromDevice(ScreenDC);
  11.   LocalBitmap.SaveToFile('/home/mpskinner/Desktop/zz.bmp');
  12.   LocalBitmap.free;
  13.   form1.Visible:=true;
  14.   ReleaseDC( 0, ScreenDC );
  15. end;
  16.  
  17.  

I'm lost. Any pointers appreciated..

Thank You..

dsiders

  • Sr. Member
  • ****
  • Posts: 387
Lazarus 2.1 (SVN) / FPC 3.0.4 / FPC 3.2.0 / x86-win64 / Windows 8.1

Possum

  • Jr. Member
  • **
  • Posts: 69
    • uDoPage
Re: Screen Capture Without Lazarus App Showing in Screen Capture
« Reply #2 on: August 19, 2020, 03:02:46 am »

That's the code I am using. Even though I make the form invisible it still gets included in the bitmap..

Thank You..

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 855
Re: Screen Capture Without Lazarus App Showing in Screen Capture
« Reply #3 on: August 19, 2020, 03:06:32 am »
hello,
try this :
Code: Pascal  [Select][+][-]
  1. form1.Visible:=false;
  2.   Application.ProcessMessages;
  3.     Sleep(2000);
  4.     LocalBitmap := TBitmap.Create;    

Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Possum

  • Jr. Member
  • **
  • Posts: 69
    • uDoPage
Re: Screen Capture Without Lazarus App Showing in Screen Capture
« Reply #4 on: August 19, 2020, 03:16:27 am »
Thank You.... :)

 :)

Solved

 

TinyPortal © 2005-2018