Why are my screenshots taken with native Windows cpp API returning black images only for Chrome-based apps?

  angle, c++, electron, google-chrome, windows

So I am taking picture using the following code https://superkogito.github.io/blog/CaptureScreenUsingGdiplus.html#id4

I only modified it so that it can take particular window handle (HWND) that I am interested in.
It works flawlessly unless I pass the handle to Chrome-based app (this includes any Electron app etc.)

Does anyone have a clue what might be the issue here?

P.S. All the windows I am trying to screenshot I put to foreground using SetForegroundWindow(hWnd)

Source: Windows Questions

LEAVE A COMMENT