none
Prevent Screen Capture? RRS feed

  • Question

  • Hello,

    I know this question has been asked before, but it seems like the previous questions before were not answered completely.  

    I am looking for a way to protect my window from being copied.  I've searched the web and it seems like a common approach is to overwrite the default print screen hot keys.  This would work for me, but I was hoping there was a more robust approach?  

    I was reading through the web and I found that it is possible for third-party applications to read the screen context themselves and copy the window (http://msdn.microsoft.com/en-us/magazine/cc163713.aspx)

    Is there a way to prevent this as well?   I was hoping to achieve functionality similar to Windows Media Player where if the user decides to copy the screen, the user will see a black box around the protected content.

    Thanks,
    J
    Sunday, March 22, 2009 8:11 PM

Answers

  • WMP shows black due to hardware acceleration of the rendering (video layers etc). However if you turn off hardware acceleration in WMP you can do print screen just fine.

    And like the peeps above said, there is no way to prevent capture of the content if you intend the users eyes to see said content. Hell what is to stop them plugging the monitor output into another PC with a capture card/Tivo etc etc?

    Side note VLC and PowerDVD both allow capturing of stills.

    Thanks.
    • Marked as answer by Nancy Shao Friday, March 27, 2009 7:52 AM
    Monday, March 23, 2009 6:12 PM

All replies

  • An obvious loophole is the user making a photo of her screen.  Making any code designed to prevent making a screen shot the normal way a waste of time.  You cannot it prevent it anyway unless you want to invest time writing video drivers.
    Hans Passant.
    Sunday, March 22, 2009 8:30 PM
    Moderator
  • Well, assuming that I only want to protect against the simple, how would I go about protecting my window from being captured?  I pretty much just want to mimic what Windows Media Player does when the user tries to capture the screen.  The content turns black and the user is left with nothing.

    Thanks
    Monday, March 23, 2009 1:38 PM
  • This is a hopeless effort. I can trivially copy screen regions using a free utility that sets up its own hotkey. Your program hasn't any hope of disabling it.
    Monday, March 23, 2009 3:40 PM
  • WMP shows black due to hardware acceleration of the rendering (video layers etc). However if you turn off hardware acceleration in WMP you can do print screen just fine.

    And like the peeps above said, there is no way to prevent capture of the content if you intend the users eyes to see said content. Hell what is to stop them plugging the monitor output into another PC with a capture card/Tivo etc etc?

    Side note VLC and PowerDVD both allow capturing of stills.

    Thanks.
    • Marked as answer by Nancy Shao Friday, March 27, 2009 7:52 AM
    Monday, March 23, 2009 6:12 PM
  • Thanks all for the feedback.  I greatly appreciate it. 

    I am a bit confused though on why it is a lost effort? 

    Couldn't I just hook the APIs that are used for capturing the screen and block out my window?

    Also, I tried looking up the default print screen procedure for Windows, but I didn't have any luck.  Can someone tell me where I could look to see the code that gets executed when the user pushes the print screen button?

    Thanks
    Monday, March 23, 2009 7:53 PM
  • It's not that simple, any application can get the desktop context and copy the contents into a bitmap:

    CBitmap* pbmpDesktop= 0;
        CDC    memDC;
        CRect  rect;

       
        pbmpDesktop= new CBitmap();

        CWnd* pwndDesktop= GetDesktopWindow();
        CWindowDC dcDesktop( pwndDesktop );

        memDC.CreateCompatibleDC( &dcDesktop );

        pwndDesktop->GetWindowRect( rect );
        pbmpDesktop->CreateCompatibleBitmap( &dcDesktop, rect.Width(),rect.Height() );

        // put the 'canvas' into the memDC
        CBitmap* pOldBitmap = memDC.SelectObject( pbmpDesktop );

        // copy the desktop onot the 'canvas'
        memDC.BitBlt( 0,0, rect.Width(),rect.Height(), &dcDesktop, 0, 0, SRCCOPY);

        BITMAP rBmpInfo;
        pbmpDesktop->GetBitmap( &rBmpInfo );

    Now you have a bitmap you can save to disk... hey presto...

    I summary it's a loosing battle.

    Question, why exactly do you want the users not to be able to do this?
    Monday, March 23, 2009 7:57 PM
  • Thanks for the replies.  I am writing an application that displays very private information to the user and I would like to prohibit the user from saving this information.

    To Mark:  Is that the only way to make a copy of the window?  I guess I am just looking for a comprehensive list of all possible ways a user can capture my window so that I could try to prevent at least the easiest ways :)

    Thanks again.  
    Monday, March 23, 2009 10:40 PM
  • Even in the enterprise OA security applications, one of the invincible peeps is that 'capture screen'.
    The easier way to protect the private information could be to watch out the file I/O.

    Anybody can capture the screen at one click but nobody can get it without saving it to a storage device.

    Regards,

    Tuesday, March 24, 2009 12:37 AM
  • This topic is far off-topic for this forum. If you are serious about getting a good answer, you need to use a forum in which this topic is relevant.

    This has been discussed very extensively in other forums. You are correct that the relevant APIs can be hooked and such. You can also use relatively simple solutions. The simpler solution is for you to implement, the simpler it is for someone to compromise. The simplest solutions will work only for the least knowledgeable.

    There are commercial software tools that you can purchase. You probably should use something such as that. I don't know what any are so I hope you can find them.
    Sam Hobbs; see my SimpleSamples.Info
    Wednesday, March 25, 2009 12:51 AM
  • Thanks Sam, I've looked all throughout the MSDN forums but I couldn't find a forum that is more relavent to my question.  Can you suggest a forum?
    Wednesday, March 25, 2009 2:39 PM
  • First note that you should look at the sticky threads that are permanently stuck to the beginning of each forum. The relevant one is The scope of this forum, which says that you should use a newsgroup.

    Note also that I did not say MSDN forum; I said forum. There are relevant forums in CodeProject.com and CodeGuru.com and other sites. I know your question has been discussed quite extensively in the CodeGuru forums.

    Also the Where is the Forum For…? forum is for asking where a forum is at for a specific question.

    Finally, the General Windows Development Issues forum is a MSDN forum for Windows development.
    Sam Hobbs; see my SimpleSamples.Info
    • Marked as answer by Nancy Shao Friday, March 27, 2009 7:31 AM
    • Unmarked as answer by Nancy Shao Friday, March 27, 2009 7:34 AM
    Wednesday, March 25, 2009 4:53 PM
  • Like others have said its not possible to protect something from being captured your displaying to the user. It will also work against you because legitimate users hate to have to "mess around" to capture what they can anyway see.

    If however you really WANT to punish your users in this manor then:

    Your best bet is just to use DirectX or Windows Presentation Foundation for your window output.

    This makes screen capture a "pain the the a**" for developers and users alike (though there are many tools to facilitate this they all require some form of API hooking or the capture of the entire desktop surface (which means if you programatically use other windows to obscure key areas of your display output no program will be able to capture your application output unobscured without the use of hooks, which is of course a high priviledge operation [we hope]).

    Personally though I'd like to see an end to the "protectionism" approch to business and see people moving back to the service model where people protect their business by providing an unparelleled service instead of trying to "chain" their user base to their product (please don't go Adobe on us Microsoft).

    (Side note. I hope Microsoft start approching DRM from a "policing" approach and not from a "protectionist" one. Then I also wish for world peace.. neither seems likely right now.)


    Kind Regards, V Website: http://www.kvkconsultancy.co.uk
    Saturday, February 5, 2011 3:48 PM
  • Like others have said its not possible to protect something from being captured your displaying to the user.

    This is not true. A commercial application for the prevention of screen capture has been available for more than a decade. ArtistScope provides the Copysafe solution which ensures the best security for both document (local) protection and web (online) protection.

    Their latest release, the ArtistScope Site Protection System (ASPS) uses a proprietary web browser that provides the most secure copy protection environment for all web page media including PDF and Flash... anything that can be displayed from a web page.

    And yes, site owners do have a right to prevent copy and plagiarism.

    Sunday, June 26, 2011 6:28 AM
  • I have used CreateDesktop API call to create a new Desktop and run my applications under this new desktop.

    Screen capture programs running under default Desktop can not "see" this newly created desktop

    https://msdn.microsoft.com/en-us/library/windows/desktop/ms682124%28v=vs.85%29.aspx

    Thursday, June 9, 2016 4:03 AM
  • Hello,

    I know this question has been asked before, but it seems like the previous questions before were not answered completely.  

    I am looking for a way to protect my window from being copied.  I've searched the web and it seems like a common approach is to overwrite the default print screen hot keys.  This would work for me, but I was hoping there was a more robust approach?  

    I was reading through the web and I found that it is possible for third-party applications to read the screen context themselves and copy the window (http://msdn.microsoft.com/en-us/magazine/cc163713.aspx)

    Is there a way to prevent this as well?   I was hoping to achieve functionality similar to Windows Media Player where if the user decides to copy the screen, the user will see a black box around the protected content.

    Thanks,
    J

    It can be made harder to grab a complete screen with sensitive information. One possible approach that makes screen capture harder would be to create a dynamic screen which rotates through several slices. This can work for white text on a black background. The result would be a slight graying of the text and some slight flicker.  Because the eye's response is non-linear you could divide up the screen into mostly black slices with the slice containing text occurring only 20% of the time with the rest being black and the text would still be very legible.

    One can conceive of more sophisticated approaches where the blanking screens had readable but incorrect content effectively masked out by the complement on other blanking screens so the average is the intended text but any given screen grab would yield unreadable results.

    Saturday, June 11, 2016 7:13 PM