Reputation: 1
I would like to prevent capturing screen using snipping tools. I've already prevented Print Screen by registering KeyUp event and clearing clipboard. I would like to prevent capturing screen only for particular Child Form (Popup Dialog).
I tried Form Deactivate event but as soon as user click on Snipping tool's New Snip function, it activates my application.
Edit
I found a gimmick. Please note that neither it's bulletproof solution nor its good User Experience but it might be helpful for some of you out there.
Steps
Again, as I said this is gimmick and not good User Experience but it might help someone like me whose main objective is to prevent users from taking screen shot of sensitive data.
User can still take picture using their phone or camera or screenshot VM by running your application in VM. So my solution is not bulletproof but at least it will definitely make it not so easy.
Cheers!!
Upvotes: 0
Views: 1011
Reputation: 36391
Use pInvoke to call SetWindowDisplayAffinity(hwnd, WDA_MONITOR);
From Old New thing
That said, the customer could modify their proprietary program to call the SetWindowDisplayAffinity function to indicate that the window contents should not be included in screen captures, as I noted some time ago. The desktop compositor will prevent those pixels from being included in BitBlt and other screen capture functions.
UWP applications can set the ApplicationView.IsScreenCaptureEnabled property to false to exclude a view from screen capture functions.
That said, this only makes it slightly more difficult to capture data. There are ways around it, and whatever you do, you cannot prevent anyone from whipping out a mobile phone and taking a picture, or just writing down the important parts to a notepad.
Upvotes: 1