Hiding a Window from Screen Capture on Windows with SetWindowDisplayAffinity
Windows can keep a window out of screen recordings through SetWindowDisplayAffinity, and C# desktop apps can call it with a small P/Invoke wrapper. The post explains the affinity values, the WPF handle step and where the protection stops.