Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to take screenshots of a Window with C++ in Windows?

What is the best (easiest) way to take a screenshot of an running application with C++ under Windows?

like image 854
mgiza Avatar asked Feb 10 '09 09:02

mgiza


People also ask

How do you screenshot on a Windows C?

Press the Windows key + PrintScreen on your keyboard (or, PrtSc). Screenshots are automatically saved to Pictures/Screenshots in your user directory (C:/Users/%username%/Pictures/Screenshots by default).

How do I take a screenshot of a single window?

Screenshots showing only one screen:Hit CTRL + ALT + PrtScn on your keyboard. Hit CTRL + V to paste the screenshot in Word, Paint, an email, or whatever else you can paste it into.

How do I take a perfect screenshot in Windows?

Save full screen screenshot: Windows Key + PrtScn (or Windows Key + Volume Down on a tablet) Copy screenshot of single window: Alt + PrtScn.


1 Answers

You have to get the device context of the window (GetWindowDC()) and copy image (BitBlt()) from it. Depending on what else you know about the application you will use different methods to find which window's handle to pass into GetWindowDC().

like image 81
sharptooth Avatar answered Oct 08 '22 19:10

sharptooth