1

I am trying to get the image of a window. All I have is its window handle. One possible solution is given here. The problem is that it only works when the window is completely visible. In case the window is partially visible, or hidden behind another window, the CopyFromScreen() method does not give the required result.

I am looking for a solution other than to make the window visible by making it the topmost window and then returning back to is position. The reason being, I have to capture the image frequently and for multiple windows. This will make the the screen to flicker continuously.

Community
  • 1
  • 1
ResVic
  • 117
  • 4
  • 11
  • 1
    Speculation: You might play around with sending a [WM_PRINT](http://msdn.microsoft.com/en-us/library/windows/desktop/dd145216(v=vs.85).aspx) to the window handle. – 500 - Internal Server Error Apr 23 '14 at 15:08
  • 1
    There is no direct way as you want. Simply because window has to paint itself first. And it will not paint parts which are outside of screen bounds. You will need some sort of hacking here. Either by faking its WM_PAINT somehow with your hDC or perhaps something more global (virtual display, replacing default monitor, etc.). – Sinatr Apr 23 '14 at 15:09
  • 1
    A [related question](http://stackoverflow.com/questions/242570/copying-content-from-a-hidden-or-clipped-window-in-xp). – 500 - Internal Server Error Apr 23 '14 at 23:36

0 Answers0