I'm writing a media player with C# WPF. I want to block the Screen recorder so user can not capture my content. I use this code for solve this problem: How to use SetWindowDisplayAffinity
[DllImport("user32.dll")]
public static extern uint SetWindowDisplayAffinity(IntPtr hwnd, uint dwAffinity);
/////////////
const uint WDA_MONITOR = 0x00000001;
IntPtr windowHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle;
SetWindowDisplayAffinity(windowHandle, WDA_MONITOR);
This code does work and the video not recorded, but audio still is captured.
How can prevent the recorder program to capture audio too? Or how can pause or stop my player when that code detected the recorder?
User contributions licensed under CC BY-SA 3.0