Hi I write 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:
[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 is worked and the video not recorded, But audio still capture. How can prevent the recorder program to capture audio too?
someone told me: "Blocking audio seems impossible, because there are a lot of methods to record audio (like wasapi)"
even if this is impossible, how can pause or stop my player after my code detected the recorder?
What I have tried:
[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);