Skip to content

Files

Latest commit

 

History

History

ScreenCaptureforHWND

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

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