Windows.UI.Composition-Win3.../cpp/ScreenCaptureforHWND
Robert Mikhayelyan 830f854128
Update C++ samples to use Visual Studio 2022, Platform Toolset v143, and the latest C++/WinRT (#109)
* Update AdvancedColorImages (cpp)

* Update HelloComposition (cpp)

* Update HelloVectors (cpp)

* Update ScreenCaptureforHWND (cpp)

* Update VirtualSurfaces (cpp)

* Fix null deref in VisualLayerIntegration (dotnet wpf)

* Use "latest" SDK for cpp projects

* Update cpp READMEs

* Fix accidental move of header file

* update to latest C++/WinRT version
2023-01-09 19:14:34 -08:00
..
ScreenCaptureforHWND Update C++ samples to use Visual Studio 2022, Platform Toolset v143, and the latest C++/WinRT (#109) 2023-01-09 19:14:34 -08:00
.gitattributes First set of samples for MVP summit (#19) 2019-03-19 04:05:40 -07:00
.gitignore First set of samples for MVP summit (#19) 2019-03-19 04:05:40 -07:00
README.md Update C++ samples to use Visual Studio 2022, Platform Toolset v143, and the latest C++/WinRT (#109) 2023-01-09 19:14:34 -08:00
ScreenCaptureforHWND.sln First set of samples for MVP summit (#19) 2019-03-19 04:05:40 -07:00

README.md

Screen capture for HWND

This sample demonstrates how to use the Windows.Graphics.Capture APIs in a Win32 application.

Screen capture UI

NOTE: Minimized windows are enumerated, but not captured.

Run the sample

This sample requires:

Code at a glance

This sample uses new APIs available in Windows 10, version 1903 (SDK 18362) or later.

  • CreateForWindow (HMON) APIs are in the Windows.Graphics.Capture.Interop.h header.

Win32 vs UWP

For the most part, using the API is the same between Win32 and UWP. However, there are some small differences.

  1. The GraphicsCapturePicker won't be able to infer your window in Win32, so you'll have to provide your window's HWND.
  2. Direct3D11CaptureFramePool requires a DispatcherQueue much like the Composition APIs. You'll need to create a dispatcher for your thread.

See also

Windows.Graphics.Capture Namespace