take screenshot lazarus / 39-Graphics ---------------------------------------------------------------------- BubikolRamios · 2012-01-04 08:41 http://wiki.lazarus.freepascal.org/Developing_with_Graphics#Taking_a_s creenshot_of_the_screen great, it takes screenshot, including your form on it. Besides hiding/showing my form in between, which is ugly, I have no other idea how to take screenshot of everything behind my/focused form ? ---------------------------------------------------------------------- Leledumbo · 2012-01-04 08:57 Sure, the method takes whatever on the screen buffer, so your approach is not ugly. Besides, it works, right? ---------------------------------------------------------------------- felipemdc · 2012-01-04 10:00 Quote from: BubikolRamios on January 04, 2012, 09:41:23 amgreat, it takes screenshot, including your form on it. Besides hiding/showing my form in between, which is ugly, I have no other idea how to take screenshot of everything behind my/focused form ? Screenshot ignoring 1 form is pretty hard and gets broken aften by new OS releases. Up to Windows Vista there was an way to do this, but in Windows 7 already it stopped working. Aero broke it. In Linux one could try doing this with XComposite (I tried, is very hard) and in Mac maybe using the window listing way of doing screenshots. ---------------------------------------------------------------------- Jishaxe · 2012-03-16 14:50 I wouldnt regard hiding the form as ugly! Taking the screenshot should only take a second anyway ---------------------------------------------------------------------- zeljko · 2012-03-16 16:16 Yes, why not hide form ? Under kde you have KSnapshot app which does same thing - hides itself and then shows itself with loaded (stretched) screenshoot in small window, so then you can save it or do whatever. Also, it have timeout so before it triggers, you have some time (eg. few seconds) to select desired form ---------------------------------------------------------------------- Shebuka · 2012-03-16 17:56 I'm using Application.Hide for this purpose, but in some strange way it's not working well 100% of time, sometimes it simple not hide and i take screenshot with my forms... ---------------------------------------------------------------------- zeljko · 2012-03-16 21:30 Then fill an issue about it. Application.Hide should do exactly what it's name says 100% accurate on all platforms. What's problematic widgetset ? ---------------------------------------------------------------------- Shebuka · 2012-03-19 09:11 Quote from: zeljko on March 16, 2012, 10:30:02 pmThen fill an issue about it. Application.Hide should do exactly what it's name says 100% accurate on all platforms. What's problematic widgetset ? It's Carbon, i'v tried also to put a Application.ProcessMessages and then even a sleep(32) Code: [Select]var   MyBitmap: TBitmap;   ScreenDC: HDC;   WrkJpg: TJpegImage; ...       Application.Minimize;       Application.ProcessMessages;       Sleep(32);       MyBitmap := TBitmap.Create;       ScreenDC := GetDC(0);       MyBitmap.LoadFromDevice(ScreenDC);       Application.Restore;       Application.BringToFront;       //Per avere un elenco dei vari formati disponibili (png, bmp, xmp, ecc.):       //http://wiki.lazarus.freepascal.org/Developing_with_Graphics#Im age_formats       WrkJpg := TJpegImage.Create;       try         WrkJpg.CompressionQuality := 80;         WrkJpg.Assign(MyBitmap);         WrkJpg.SaveToFile(Utf8ToSys(ScreenName));       finally         FreeAndNil(WrkJpg);       end;       ReleaseDC(0, ScreenDC);       FreeAndNil(MyBitmap); ---------------------------------------------------------------------- zeljko · 2012-03-19 18:33 What's so magic with sleep(32) ... it can be any number.... but anyway, as I said if Application.Minimize & Application.Restore does not work correct on some widgetset then please open an issue and attach compileable example ...