Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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);
Posted
Comments
Richard Deeming 10-Nov-20 11:19am    
Even if you manage to prevent that, what if the user runs your application in a VM and records from the host? Or connects to the PC running your application via RDP and records that?

If all else fails, they could record their screen on their mobile phone.

Copy Protected - The Daily WTF[^]
link1234 10-Nov-20 12:09pm    
I have watermark with the personal information of my user on the video. So if they find someway to record or use smartphone and another device to capture content I can use the copyright to protect my program.
basically I know There is no absolute way to prevent this. But at least I try Protect my app as as far as I can. also not anyone have programming or IT experience to find the way for capture content.
Dave Kreskowiak 10-Nov-20 12:59pm    
Ever hear of a smart phone?
link1234 10-Nov-20 13:24pm    
Did you read my text at all?
"I have watermark with the personal information of my user on the video. So if they find someway to record or use smartphone and another device to capture content I can use the copyright to protect my program.
basically I know There is no absolute way to prevent this. But at least I try Protect my app as as far as I can. also not anyone have programming or IT experience to find the way for capture content."
Dave Kreskowiak 10-Nov-20 13:42pm    
Yes, I did, and the watermark can be removed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900