Windows Desktop Window Manager (DWM) & WDA_EXCLUDEFROMCAPTURE: Complete Architectural Breakdown
Comprehensive engineering breakdown of Windows DWM capture exclusion. Understand SetWindowDisplayAffinity, DirectX swapchains, and capture surfaces.
On Windows, the Desktop Window Manager (DWM.exe) is responsible for composing every visible window into the primary desktop frame. Exploring how DWM implements display affinity reveals why excluded windows are completely private to screen share capture.
Evolution of Windows Display Affinity: From WDA_MONITOR to WDA_EXCLUDEFROMCAPTURE
Originally created to protect HDCP copyright content, SetWindowDisplayAffinity accepted WDA_NONE (0x00) and WDA_MONITOR (0x01). However, WDA_MONITOR caused video feeds to display an obvious black square.
Microsoft resolved this in Windows 10 Build 19041 (Version 2004) by adding WDA_EXCLUDEFROMCAPTURE (0x11). Under this flag, DWM modifies the render tree:
BOOL result = SetWindowDisplayAffinity(hWnd, 0x00000011);
DirectX Swapchains & DWM Composition Pipeline
Every modern Windows desktop application presents rendered UI frames into a DirectX (DXGI) Swapchain. DWM takes these textures and compiles the final frame sent to the display adapter.
Desktop Duplication API (DXGI) Behavior Under WDA_EXCLUDEFROMCAPTURE
When Zoom or Teams calls IDXGIOutputDuplication::AcquireNextFrame, DWM provides a capture surface from which all windows with display affinity exclusion have already been pruned.
Handling Windows 10 vs. Windows 11 Kernel Differences
Windows 11 features optimizations in dwmcore.dll that ensure rounded window corners and drop shadows are also cleanly excluded without rendering halos.