简体   繁体   English

有条件地从桌面屏幕快照中隐藏特定窗口

[英]Conditionally hiding specific window from desktop screenshot

Is this possible. 这可能吗。 I have three (3) windows: 我有三(3)个窗口:

  • Window1 - not active Window1-无效
  • Window2 - not active Window2-无效
  • Window3 - active Window3-活动

If I take the screenshot of the desktop I want Window3 to be hidden quietly. 如果我获取桌面的屏幕截图,我希望Window3被安静地隐藏。 Provided the user is using Window3 the program must not in any way hide the windows like minimizing it or anything. 如果用户使用的是Window3则程序不得以任何方式隐藏窗口,例如将其最小化。 In short, I need an unobtrusive way of hiding specific windows from desktop screenshot. 简而言之,我需要一种简便的方法来从桌面屏幕快照中隐藏特定的窗口。

That's not going to be possible without quite a bit of work. 没有大量的工作就不可能实现。 The print screen functionality just copies the contents of the desktop DC to an image and places it on the keyboard. 打印屏幕功能只是将桌面DC的内容复制到图像上并将其放置在键盘上。 It doesn't actually re-render the whole desktop into a new DC. 它实际上并没有将整个桌面重新渲染为新的DC。 So there's no way that it can silently remove a particular window. 因此,它不可能无声地删除特定的窗口。

I suppose you could hook the print screen button (or the function, whatever it is) and allow it to create the image on the clipboard. 我想您可以钩住打印屏幕按钮(或功能,不管它是什么),并允许它在剪贴板上创建图像。 Then your hook could read the location of the window in question from the desktop and clear out that area of the bitmap that's on the clipboard. 然后,您的钩子可以从桌面读取相关窗口的位置,并清除剪贴板上位图的该区域。

Your hook would do this: 您的钩子可以这样做:

call the normal print screen function
load image from clipboard
get location and size of Window3 from desktop
fill that rectangle in the image with black (or whatever)
put the modified image back on the clipboard

Assuming, of course, that you can hook the print screen function. 当然,假设您可以挂钩打印屏幕功能。 I suspect it's possible, although I've never tried it. 我怀疑这是可能的,尽管我从未尝试过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM