I have a requirement to develop an application that will capture the screenshots of any open window. So if that window is overlappedby some other window partially or fully, is it technically possible to take its screenshots? If yes, the how?
maverick786us wrote: > I have a requirement to develop an application
that will capture the screenshots of any open window. So if that window
is > overlappedby some other window partially or fully, is it technically
possible to take its screenshots?
Generally, no. Parts of windows obscured by other windows are not being
rendered, so there are no actual pixels to capture. The information
necessary to produce an image exists only in internal data structures of the
Now, some windows might respond to WM_PRINT or WM_PRINTCLIENT messages, and
render themselves to an HDC of your choice. The problem with this is that HDC is
process-specific and cannot be passed across process boundaries. So you would
have to inject some code into the other application's process that would create
an in-memory HDC, send WM_PRINT[CLIENT] message to the window, then somehow
transfer the resulting bitmap back to your application. All doable, but a lot of
work (and, again, not all windows actually respond to those messages, so this
work may be in vain). -- Igor Tandetnik
Friday, March 19, 2010 12:22 PM
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.