Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The reason that PrintWindow does not work is because it depends on the correct handling of the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/dd145216%28v=vs.85%29.aspx" rel="nofollow">WM_PRINT</a> message by the app. A lot of apps are flaky with WM_PRINT and don't implement it right or ever test it. It's therefore a bad idea to rely on it unless you use it only on known and tested apps.</p> <p>If you want to grab the window as it shows on screen, just blt it from the Desktop window handle (<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms633504%28v=vs.85%29.aspx" rel="nofollow">GetDesktopWindow()</a>) and only blt the rect that includes the window.</p> <p>Transparency is an issue with window grabbing. It is impossible to capture modern Windows OS' windows, because there is no image file type that supports fanciness like blurring the underlying imagery. However, it's possible to capture simple transparency into a PNG file.</p> <p>Be careful with assuming a window looks best as seen on screen. Depending on what's underneath, this may not be true. It may also be a bad idea to copy whatever's underneath as it may not be sanctioned to appear in the image, like an explicit background image appearing in a business presentation under a screenshot of Excel :).</p> <p>If you blt from the desktop, you copy what you see on screen, including any overlaying windows and underlying windows (where transparent). It is usually regarded as "cleaner" to grab the window only, as with PrintWindow, but you may want to composite this on a background of your choice, like white or blue. If you want to blt from screen, there are ways to temporarily hide windows that overlay your target, but it's a bunch of work with EnumWindows and such.</p> <p>Grabbing windows <em>correctly</em> is not an easy task in Windows and there are many screen-grab apps that compete with each other by virtue of how well they deal with exactly this issue. Also, in Windows there are several ways to make make areas of windows transparent, and they can be used together as well.</p> <p>Also, in Vista+, there's the <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa969521(v=vs.85).aspx" rel="nofollow">DWM thumbnail API</a> which allows you to get a copy of an app window drawn on your window. For a demo and source, see <a href="https://github.com/ShareX/ShareX" rel="nofollow">ShareX</a> (formerly zScreen).</p> <p>Finally, you can look into the source of <a href="https://obsproject.com/" rel="nofollow">Open Broadcaster Software</a>, which uses Direct3D to do some screen grabbing.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload