title: C++ - How to screen-capture, except for some windows
body: <p><strong>Situation</strong>: 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.</p>
  
  <p>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.).</p>
  
  <p>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).</p>
  
  <p>The screenshots are sent at approximately 10 frames-per-second, or faster.</p>
  
  <p><strong>Question</strong>: how can I programmatically capture the screen, except for these NON-SHARING-WINDOWS windows?</p>
  
  <p><strong>Notes</strong>:</p>
  
  <ul>
  <li>Because of the higher frames-per-second value, I cannot minimize/maximize/set alpha for these windows, because then the windows will flicker. The application is written in Win32 C++.</li>
  <li>I would use layered windows, but because of the Windows 7 Desktop Composition feature, this is not usable out-of-the-box (and in Windows 8, you cannot use DwmEnableComposition anymore to temporarily and programmatically disable composition)</li>
  <li>I could use the layered window approach for Windows XP/2000/7 etc., and a different approach for Windows 8 (if there is one), though I would prefer a single process that works on all systems</li>
  <li>I could also try to "compose" the screenshots by capturing individual images (of the desktop, the windows that need to be captured) and using their z-index to create the final image, but because of the required frames-per-second value, this process would be too slow.</li>
  </ul>