title: How to take a screenshot of a partially hidden window in a programmatic way without brining it to front?
body: <p>Is it possible to take a screenshot of a partially hidden window without brining it to front? I know this is possible because the Screen Capture API already does this.</p>
  <p><a href="https://developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API/Using_Screen_Capture" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/Screen_Capture_API/Using_Screen_Capture</a></p>
  <p><a href="https://i.stack.imgur.com/z1EYl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z1EYl.png" alt="Screen Capture Popup" /></a></p>
  <p>The picture shows the popup when you initiate a capture process. You can see the same popup on Discord or Slack whenever you would like to share your screen. In the popup, you can see the list of the windows that I have open. Some of the windows are partially or completely hidden. However the popup shows the entire contents of them, which is surprising to me. The popup does not show minimized windows, which is fine. This works cross-platform.</p>
  <p>I would like to know how the Screen Capture API does this as I have never succeeded in doing so. I personally tried with Win32 + GDI32 APIs but I was unable to take the screenshot of a hidden window. I would prefer a cross-platform solution but for now  I am only targeting Windows 10+.</p>
  <p>Thank you in advance.</p>