How do I make it more difficult for somebody to take a screenshot of my window?

Raymond Chen

Ultimately, you can’t stop somebody from ignoring the words Confidential at the top of a document and whipping out a digital camera and taking a picture of the screen. But at least starting in Windows 7 you can make it a little more difficult.

Take our scratch program and add this one line:

SetWindowDisplayAffinity(hwnd, WDA_MONITOR);
    ShowWindow(hwnd, nShowCmd);

Assuming you have the Desktop Window Manager enabled, you will find that attempting to capture our scratch program in a screenshot or via the Snipping Tool will result in black pixels.

Remember, this is just an obstacle, not a security measure. If somebody is determined to get the pixels, this step is only going to slow them down a little. (For example, on Windows 7, they can simply disable the Desktop Window Manager.) But it’s handy for reducing the likelihood of an accidental breach of confidential information.

Pre-emptive hate: “DRM is evil!” My response to you: If you don’t like DRM, then don’t buy DRM-protected content. If you don’t like IRM, then don’t read IRM-protected documents. If you don’t like Blu-Ray, then don’t buy Blu-Ray DVDs.


Discussion is closed.

Feedback usabilla icon