microsoft / Windows.UI.Composition-Win32-Samples

Windows.UI.Composition Win32 Samples
MIT License
459 stars 186 forks source link

Possible to build GraphicsCaptureItem from HWND, for win10 1809? #62

Closed chen2qu closed 4 years ago

chen2qu commented 4 years ago

I have a question on how to build a GraphicsCaptureItem from current window's HWND in Win10 1809. We want to use Windows.Graphics.Capture APIs to capture our own win32 C++ application to a video. The problem is that we're all on Win10 1809, and CreateForWindow is added in Win10 1903. So it's a problem for us to get the GraphicsCaptureItem item for our window the capture. Any idea on how I can do this? Appreciated for any help or comment!

robmikh commented 4 years ago

As you noted, we added the CreateForWindow API in the 1903 build. Unfortunately it is unavailable to prior versions of Windows. On the 1809 build you'll need to use the picker to initiate a screen capture.

chen2qu commented 4 years ago

I see. Our case is that we just want to record our own app so it's kind of weird and unnecessary to launch the picker. Anyway thanks for the reply.