C ++ - as for screen capture, except for some windows

The situation . I have software that shares screen sharing over the Internet, where one user acts as a host and other users act as viewers / participants.

In addition to the presentation windows, the presenter also has a set of NOT-DETECTED WINDOWS that appear on the screen (a panel of buttons to start sharing / stop / etc., Skype windows, etc.).

The host can configure the screen sharing software to make these ILLEGAL WINDOWS invisible (i.e. they will not appear in the screen sharing, which is sent to visitors, but the contents of the window behind them will appear in the screenshot).

Screenshots are sent at about 10 frames per second or faster.

Question : how can I programmatically capture the screen, except for these non-DETECTION-WINDOW windows?

Notes

  • Due to the higher frames per second, I cannot minimize / maximize / set the alpha for these windows, because then the windows will flicker. The application is written in Win32 C ++.
  • I would use multi-level windows, but due to the layout function of Windows 7 Desktop this cannot be used out of the box (and in Windows 8 you can no longer use DwmEnableComposition to temporarily and programmatically disable the composition)
  • I could use a layered window approach for Windows XP / 2000/7, etc., and a different approach for Windows 8 (if any), although I would prefer one process that works on all systems.
  • I could also try to β€œcompose” screenshots by capturing individual images (desktop, windows that need to be captured), and use their z-index to create the final image, but due to the required frames for the average value, this process will be too slow.
+7
source share
2 answers

In windows, even the desktop is considered a window and has its own HWND. It seems, however, not easy to just copy the β€œwallpaper” yourself.

So, I basically see two ways to do this. 1. Copy the entire desktop, for example. BitBlt (GetWindowDC (GetDesktopWindow ()), ...)

OR

  1. Use GetWindow and move the list of windows in the opposite direction, starting with a Window-Window whose HWND you can define using GetDesktopWindow (), for example:

    // paint on a black DC hwnd=GetDesktopWindow() while (hwnd = GetWindow(hwnd, GW_HWNDPREV)) { // is this window not shared? continue // else bitblt it into our dc }

I hope I took a little breath :-) If someone knows the way to copy ONLY the desktop without its child windows, please let me know.

+1
source

I think that restricting the capture contents in a large window will be easier. otherwise, you will need to crop some windows from the screen capture.

-one
source

All Articles