0

I'm trying to get a screenshot of windows using PrintWindow. Windows using hardware rendering are not captured. For example Chrome, Edge. In Windows 7 they are captured, but in Windows 10, 11 they are no longer there. There is a suspicion that this is due to the version of WDDM. Is there any possibility:

  • capture hardware rendering?
  • disable hardware rendering for the whole system?
  • Disable or otherwise affect WDDM?
  • Does this answer your question? [PrintWindow() could not print Google Chrome window (Chrome\_WidgetWin\_1)](https://stackoverflow.com/questions/30965343/printwindow-could-not-print-google-chrome-window-chrome-widgetwin-1) – Simon Mourier Sep 06 '22 at 06:12
  • 2
    Try using [`Windows.Graphics.Capture`](https://learn.microsoft.com/en-us/windows/uwp/audio-video-camera/screen-capture) instead. There's [interop support](https://learn.microsoft.com/en-us/windows/win32/api/windows.graphics.capture.interop/nf-windows-graphics-capture-interop-igraphicscaptureiteminterop-createforwindow) for native `HWND`'s. – IInspectable Sep 06 '22 at 08:46

1 Answers1

1

I 've made a simple capture library here. Code is here and it's based on Desktop Duplication API. Microsoft sample is here. It uses hardware capturing.

My work primarily captures video with sound, but there is a frame callback you can use to capture a frame. Apparently it's the same API that is used to capture games etc.

Michael Chourdakis
  • 10,345
  • 3
  • 42
  • 78
  • 1
    Desktop Duplication doesn't allow you to take a screenshot of a window that's partially occluded, fully hidden, or minimized. – IInspectable Sep 25 '22 at 17:14