简体   繁体   中英

Conditionally hiding specific window from desktop screenshot

Is this possible. I have three (3) windows:

  • Window1 - not active
  • Window2 - not active
  • Window3 - active

If I take the screenshot of the desktop I want Window3 to be hidden quietly. Provided the user is using Window3 the program must not in any way hide the windows like minimizing it or anything. 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. It doesn't actually re-render the whole desktop into a new 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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