Situation: I have a software that performs screen sharing over the Internet, where one user acts as a presenter, and other users act as viewers/attendees.
Besides the presentation windows, the presenter also has a set of NON-SHARING-WINDOWS that appear on the screen (a button bar for start sharing/stop sharing/etc., a Skype window etc.).
The presenter can configure from the setup of the screen sharing software to make these NON-SHARING-WINDOWS invisible (i.e. they will not appear in the screen sharing that is being sent to the attendees, but the window content behind them will appear in the screenshot).
The screenshots are sent at approximately 10 frames-per-second, or faster.
Question: how can I programmatically capture the screen, except for these NON-SHARING-WINDOWS windows?
Notes:
Press Ctrl + PrtScn keys. The entire screen changes to gray including the open menu. Select Mode, or in earlier versions of Windows, select the arrow next to the New button. Select the kind of snip you want, and then select the area of the screen capture that you want to capture.
Snipping tool is a program which is part of Windows Vista and above versions. Snipping Tool allows you to take a screenshot of your screen. It can be delayed for a few seconds while capturing the screen in case of hover. It allows the user to capture the whole screen or user-specified area in a rectangular form.
Snipping Tool helps you to take a screenshot of your screen. It enables users to capture the whole screen or selected area in a rectangular form.
1. Hold down the alt key and press the Print Screen button on your keyboard. This will capture only the in-focus/active window (the window 'on top'. This places the image on the clipboard, ready to be pasted into an application.
In windows even the desktop is considered a window and has its own HWND. It seems however, not easily possible to only copy the "wallpaper" on its own.
So i basically see two ways to do that. 1. Copy the entire desktop e.g. BitBlt(GetWindowDC(GetDesktopWindow()),...)
OR
Use GetWindow
and traverse the window list in backward direction starting from the Desktop-Window whose HWND you just can determine with GetDesktopWindow(), Like this:
// 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
}
Hope i gave some inspiration :-) If someone knows a way how to copy ONLY the desktop without its child windows please let me know.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With