[英]WinForm C# : How to prevent Snipping tool or Snip & Sketch tool to capture screen shot of the particular child window?
I would like to prevent capturing screen using snipping tools.我想防止使用截图工具捕获屏幕。 I've already prevented Print Screen by registering KeyUp event and clearing clipboard.我已经通过注册 KeyUp 事件和清除剪贴板来阻止 Print Screen。 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.我尝试了 Form Deactivate 事件,但是一旦用户单击 Snipping 工具的 New Snip function,它就会激活我的应用程序。
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.用户仍然可以通过在 VM 中运行您的应用程序来使用他们的手机或相机或截图 VM 拍照。 So my solution is not bulletproof but at least it will definitely make it not so easy.所以我的解决方案不是万无一失的,但至少它肯定会让它变得不那么容易。
Cheers!!干杯!!
Use pInvoke to call SetWindowDisplayAffinity(hwnd, WDA_MONITOR);
使用 pInvoke 调用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.也就是说,客户可以修改其专有程序以调用 SetWindowDisplayAffinity function 以指示 window 内容不应包含在屏幕截图中,正如我前段时间所指出的那样。 The desktop compositor will prevent those pixels from being included in BitBlt and other screen capture functions.桌面合成器将阻止这些像素包含在 BitBlt 和其他屏幕捕获功能中。
UWP applications can set the ApplicationView.IsScreenCaptureEnabled property to false to exclude a view from screen capture functions. UWP 应用程序可以将ApplicationView.IsScreenCaptureEnabled属性设置为 false 以从屏幕捕获功能中排除视图。
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.有办法绕过它,无论你做什么,你都无法阻止任何人拿出手机拍照,或者只是将重要的部分写到记事本上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.