Capturing a Window

JChild 21 Reputation points
2022-04-05T16:10:43.833+00:00

I am trying to capture an application's display and stream it to another computer. The application is composed of multiple program windows. I found the following examples and used them to create a window with a composition host that captures multiple windows and combines them into one window.

https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/tree/master/cpp/ScreenCaptureforHWND

https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/tree/master/cpp/HelloComposition/HelloComposition

When I try to capture the new window I am only able to get the new window's background color. I have tried using GDI+ (StretchBlt and BitBlt) and DirectX but they are unable to capture the new window with the combined layers. They just capture the background of the new window. The code I am writing is on a stand alone network so I am unable to post the actual source code.

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,481 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,601 questions
{count} votes

Accepted answer
  1. Castorix31 82,491 Reputation points
    2022-04-08T19:29:02.79+00:00

    I tested with HelloComposition sample, and I can copy the window with
    PrintWindow and PW_RENDERFULLCONTENT flag (into a compatible DC with CreateCompatibleDC)
    I added a SS_BITMAP Static control where I set the copied bitmap with STM_SETIMAGE :

    191454-printwindow.gif

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful