You are on page 1of 10

27/04/2016

Prevent Screen Capture?

Search Visual Studio with Bing

GALLERY

MSDN LIBRARY

FORUMS

Ask a question

SIGN IN

get started for free


Search related threads

Search forum questions

Quick access

Prevent Screen Capture?

Answered by:

1,635
Points

Top 5%

Visual Studio Languages , Windows Desktop Development > Visual C++


Question
Hello,

Mark Duffill
Joined Oct 2008

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

Mark Duffill's th
2

Show activity

Top related threads

1
Sign in
to vote

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?

does SetWindowDisplayAffinity
function prevent screen capturing?
HOW TO STOP / PREVENT
SCREEN CAPTURE VIDEO IN VB?
Programmatically Prevent Screen
Capture in Windows Phone 7.5/8
It says screen capture can be
prevented. Really?
Randomly capturing "Black" screen

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/enus/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
Reply | Quote

Jon Salepor

35 Points

Answers

https://social.msdn.microsoft.com/Forums/vstudio/en-US/9650cac8-9c83-4131-b85a-0b4d95a977ee/prevent-screen-capture?forum=vcgeneral

1/10

27/04/2016

Prevent Screen Capture?

1
Sign in
to vote

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


Reply | Quote

Mark Duffill

1,635 Points

All replies

0
Sign in
to vote

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
Reply | Quote

https://social.msdn.microsoft.com/Forums/vstudio/en-US/9650cac8-9c83-4131-b85a-0b4d95a977ee/prevent-screen-capture?forum=vcgeneral

Moderator

nobugz (MCC, MVP)

236,895 Points

2/10

27/04/2016

Prevent Screen Capture?

0
Sign in
to vote

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
Reply | Quote

Jon Salepor

35 Points

0
Sign in
to vote

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
Reply | Quote

Brian Muth (MCC, MVP)

62,800 Points

1
Sign in
to vote

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


Reply | Quote

https://social.msdn.microsoft.com/Forums/vstudio/en-US/9650cac8-9c83-4131-b85a-0b4d95a977ee/prevent-screen-capture?forum=vcgeneral

Mark Duffill

1,635 Points

3/10

27/04/2016

Prevent Screen Capture?

0
Sign in
to vote

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
Reply | Quote

https://social.msdn.microsoft.com/Forums/vstudio/en-US/9650cac8-9c83-4131-b85a-0b4d95a977ee/prevent-screen-capture?forum=vcgeneral

Jon Salepor

35 Points

4/10

27/04/2016

Prevent Screen Capture?

0
Sign in
to vote

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
Reply | Quote

https://social.msdn.microsoft.com/Forums/vstudio/en-US/9650cac8-9c83-4131-b85a-0b4d95a977ee/prevent-screen-capture?forum=vcgeneral

Mark Duffill

1,635 Points

5/10

27/04/2016

Prevent Screen Capture?

0
Sign in
to vote

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
Reply | Quote

Jon Salepor

35 Points

2
Sign in
to vote

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


Reply | Quote

https://social.msdn.microsoft.com/Forums/vstudio/en-US/9650cac8-9c83-4131-b85a-0b4d95a977ee/prevent-screen-capture?forum=vcgeneral

Yangghi Min

680 Points

6/10

27/04/2016

Prevent Screen Capture?

0
Sign in
to vote

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
Reply | Quote

Simple Samples

11,680 Points

0
Sign in
to vote

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
Reply | Quote

https://social.msdn.microsoft.com/Forums/vstudio/en-US/9650cac8-9c83-4131-b85a-0b4d95a977ee/prevent-screen-capture?forum=vcgeneral

Jon Salepor

35 Points

7/10

27/04/2016

Prevent Screen Capture?

1
Sign in
to vote

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


Reply | Quote

https://social.msdn.microsoft.com/Forums/vstudio/en-US/9650cac8-9c83-4131-b85a-0b4d95a977ee/prevent-screen-capture?forum=vcgeneral

Simple Samples

11,680 Points

8/10

27/04/2016

Prevent Screen Capture?

0
Sign in
to vote

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 05, 2011 3:48 PM
Reply | Quote

KVK Consultancy

245 Points

0
Sign in
to vote

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


Reply | Quote

https://social.msdn.microsoft.com/Forums/vstudio/en-US/9650cac8-9c83-4131-b85a-0b4d95a977ee/prevent-screen-capture?forum=vcgeneral

WilliamKent

0 Points

9/10

27/04/2016

Prevent Screen Capture?

DEV CENTERS

RELATED SITES

CONNECT

DEVELOPER RESOURCES

Windows

Visual Studio

Forums

Code samples

Office

Visual Studio Integrate

Blog

Documentation

More...

VSIP Program

Facebook

Downloads

Microsoft .NET

LinkedIn

Products & extensions for Visual Studio

Microsoft Azure

Stack Overflow

REST APIs

Twitter

Testing tools for web developers

Visual Studio Events

Videos and tutorials

YouTube

Virtual Labs

United States

2016 Microsoft

Terms of Use

Trademarks

Privacy Statement

Site Feedback

(English)

https://social.msdn.microsoft.com/Forums/vstudio/en-US/9650cac8-9c83-4131-b85a-0b4d95a977ee/prevent-screen-capture?forum=vcgeneral

10/10

You might also like