Search code examples
screencaptureinvisible

How to make a rectangle on screen invisible to screen capture?


How can I create a rectangle on the screen that is invisible to any sort of screen capture(printscreen or aplications) ?

By create a rectangle on screen I mean something like this:

#include <Windows.h>
#include <iostream>

void drawRect(){
HDC screenDC = ::GetDC(0);
::Rectangle(screenDC, 200, 200, 300, 300);
::ReleaseDC(0, screenDC);
}
int main(void){
char c;
std::cin >> c;
if (c == 'd') drawRect();
std::cin >> c;
return 0;
}

I'm using Visual Studio 2010 on Windows XP


Solution

  • You cannot prevent this unless by means of hardware, as far as I know.

    But.. what you could do (with a lot of effort) is to make it a lot harder.

    Some tools have problems with tansparent windows, so you could put one of them on top of your window. You might experiment with custom-drawn parts.

    What might make it really hard is to use DirectX output for that rectangle (though this is by no means an easy task - DirectX and WinForms, MFC or plain Win32 are not really compatible at all.

    Still, you could have a look here Take screenshot of DirectX full-screen application for people describing their problems on capturing DirectX apps.