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

mgiza picture mgiza · Feb 10, 2009 · Viewed 30.4k times · Source

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

Answer

sharptooth picture sharptooth · Feb 10, 2009

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().