I display a video in a media player after I decrypt it, and I want to make it save across and prevent print screen and screen recording by any program.
Screen Capture protection is possible in Android App, IOS App or IOs browser, but desktop and android browsers can not prevent screen capture.
but if you want to restart the permissions Go to Application Manager -> App Permissions -> Requested Permission -> turn it off / on for your program .
Office 2013 and later tries to prevent screenshots of Office application windows if they have an IRM-document currently open. When you take a screenshot you get a black rectangle instead of the window contents.
I asked a similar question a few years ago. You can prevent screenshots of your application window by using SetwindowDisplayAffinity
: How does Office 2013 implement black windows for IRM?
HWND myWindowWindowHandle = ...
BOOL ok = SetWindowDisplayAffinity( myWindowWindowHandle, WDA_MONITOR );
if( !ok ) exit(1);
ShowWindow( myWindowWindowHandle, SW_NORMAL );
This requires Windows 7 or later, and the system must be running with the DWM enabled (the DWM always runs on Windows 8 or later).
Raymond Chen also blogged about it here: https://blogs.msdn.microsoft.com/oldnewthing/20130603-00/?p=4193
In the old days (before the DWM in Windows) video was often displayed using the Video Overlay feature in graphics cards, where compressed video would be fed into the GPU and decoded and never sent back into system RAM (instead a special color was used to define pixels on screen where the video would be overlayed: https://en.wikipedia.org/wiki/Video_overlay, so that's why previously screenshots could not be taken of video: it wasn't DRM, just a side-effect of a performance optimization)
Note that it is mathematically impossible for DRM to work perfectly (in the Alice and Bob analogy, Bob (the intended recipient) and Charlie (someone trying to intercept the content) are the same person), so be wary of investing too much time into this.
Note that SetWindowDisplayAffinity
does not stop all screen-recording tools, for example recent GPUs have built-in support for hardware-accelerated display output capture (I believe this is what the Windows Game DVR uses) which might not be affected by WDA_MONITOR
. Users could also run your software in a virtual-machine environment, or modify Windows to disable the DWM (trivial on Windows 7, difficult but still possible on Windows 8 and 10).
There's a comment in Raymond Chen's blog which cautions that another process (with a hWnd
of another process' window) could simply call SetWindowDisplayAffinity( otherProcessesWindowHandle, WDA_NONE );
to remove DisplayAffinity protection. I don't know if it would work or not, I'd like to ask you to try it and let us know if another process can defeat it that way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With