Search code examples
windowssecurityscreenshot

Detect when users take screenshots of my program


I'm writing a Windows application. How can I tell when a screenshot is being taken of it? I read about how to detect the hotkey being pressed, but I'm more worried about the case where every 100 ms or so another program is taking screenshots of it. Namely, I'm trying to notice when someone creates another program (say a python one using ImageGrab, as mentioned in another post) which constantly takes screenshots of my app and uses them to read info off of it.

I don't care much about preventing the screenshots from being taken - I can just ban the user once this behavior is noticed.

Is this possible? Is there a windows message sent when any app takes a screenshot, like with WM_HOTKEY? Or does windows just use the latest info from the latest paint events, and return that to the other program directly, without my app being able to notice at all?


Solution

  • Whatever you do, people will find a way around it. Suppose such a method existed, where you could reliably detect another program taking a screenshot of your application. To get around that, I could install VirtualBox, run your application inside the VM, and then have a program take screenshots of VirtualBox (which then contains your application). Your application would have absolutely no way to know it was having its picture taken.