Screenshot from current window lazarus / 10-Designer ---------------------------------------------------------------------- McReier · 2013-11-29 23:03 Hello together, I have in my program multiple windows and would like to make the current window take a screenshot? Can anyone help, as the source code is optimized to me? With current source a screenshot is made ​​from full screen. Heres may source: Code: [Select]procedure TForm15.Button1Click(Sender: TObject); var   MyBitmap: TPicture;   ScreenDC: HDC; begin   MyBitmap := TPicture.Create;   try   ScreenDC := GetDC(0);   MyBitmap.Bitmap.LoadFromDevice(ScreenDC);   MyBitmap.Bitmap.Width := Round(827);   Mybitmap.Bitmap.Height := Round(647);   ReleaseDC(0, ScreenDC);     MyBitmap.Bitmap.SaveToFile('Test.bmp');   finally     MyBitmap.Free;   end; end; Thank you! ---------------------------------------------------------------------- BlueIcaro · 2013-11-29 23:29 Change the GetDc(0) to : GetDC(Form15.Handle) To get the client area of the Form15. GetDc gets the client area or entire screen according to microsoft : http://msdn.microsoft.com/en- us/library/windows/desktop/dd144871%28v=vs.85%29.aspx I'm not sure (I'm thinking and writting), but if you want capture only the form, make a bitmap of entire screen, and the copy to other bitmap, the area where is your form. You can know where is, because you have Top,Left, Height and width properties of it. With GetWindowDc you can copy the form. More info: http://delphi.about.com/od/adptips2006/qt/captureactive.htm /BlueIcaro Then save the second bitmap. /BlueIcaro ---------------------------------------------------------------------- McReier · 2013-11-30 08:36 Quote from: BlueIcaro on November 30, 2013, 12:29:35 amChange the GetDc(0) to : GetDC(Form15.Handle) To get the client area of the Form15. GetDc gets the client area or entire screen according to microsoft : http://msdn.microsoft.com/en- us/library/windows/desktop/dd144871%28v=vs.85%29.aspx I'm not sure (I'm thinking and writting), but if you want capture only the form, make a bitmap of entire screen, and the copy to other bitmap, the area where is your form. You can know where is, because you have Top,Left, Height and width properties of it. With GetWindowDc you can copy the form. More info: http://delphi.about.com/od/adptips2006/qt/captureactive.htm /BlueIcaro Then save the second bitmap. /BlueIcaro Hi BlueIcaro, now it works well!  Many thanks!!