• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Disable Windows Print Screen Key

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Is there a way from Java to temporarily disable the Windows Print Screen key?

Thanks,

Jess
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's probably not impossible, but might be messy. What are you trying to achieve by doing so?
 
Jessica Doe
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am looking at an app with proprietary data, which the client doesn't want people to make digital copies of, even screenshots.
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Uhm!
There are hundreds of screenshot-tools, which don't use the PrtScrn-Button (but the mouse, a timer, ...).
What if the person has a real camera?
A good brain?
 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have just looked at an application I have written that echoes the result of all key presses to System.out...I can't remember why I wrote this now, but I did...anyway, when I press the Print Scrn key on my win PC nothing appears in the console. I think this suggests you can't do anything with the print screen key in Java alone.
 
Sheriff
Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ben-
Pressing print screen by itself won't do anything -- it places a screenshot of the current screen in the clipboard. The question is while you're running your program if you can press print screen and then after opening sometype of graphics program, like Paint, can you paste the screen in there?
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

What if the person has a real camera?



Love that one. In the 80s we distributed mini-computers to sales offices with a set of marketing letters they could send to potential customers. There was a limited word processing feature so they could add custom paragraphs. An officer thought this was an outrageous risk and wanted to disable it to prevent sales folks from putting content not approved by the legal dept, eg misrepresenting our products. The manager said "And how do we prevent them from buying a typewriter?" The feature shipped.
 
Dmitry Melnik
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, if security is the main concern, then it does not make much sense to temporarily plug just one hole of many existing. Your app should probably run on a dedicated machine, accessible only to authorized users, in custom environment controllable only by trusted admins, in a room with guards, monitored by spy cameras, etc. Security regime must be well planned in advance

And here I especially agree with Stefan: a good brain is an ultimate security threat

In the case if the rest of security regime has been taken care of, and you still think that you need to disable PrintScreen, there is a set of Win32 API calls which provides setting hooks on keyboard events at a low level. So, you can write a little Win32 program, which will redefine system's reaction on certain keyboard events using the hooks. Not quite elegant solution in Java world...
 
Jessica Doe
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't write the specs, Folks. I just implement them.
 
Dmitry Melnik
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't write the specs, Folks. I just implement them.

I know. Been there. But anyway, here is an opportunity for you to bring the issue into awareness of authors of your specs It might be usefull for your career. Or not. You decide

Should the spec authors decide to go for that illusion of security, do you have enough info to move forward?
 
Stefan Wagner
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You didn't write the specs, but if they contain impossible, or nearly impossible demands, you need to tell them - needn't you?

Inside your application it's senseless to catch the print-Screen, even if it was possible, because if the customer moves the focus out of your window, he may make a screenshot very easily for the whole desktop, including your app.

And there are remote-control tools, by which you may view the content of another machine. You would have to ensure that none of these tools is running.

I don't know how to programm a low-level graphic-card scanner, which reads the graphics-memory directly - but how to avoid that?
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can lock the program into fullscreen mode, and have no other applications to show up (not even the taskbar). And then you can have a C++ program event-handle for any pictures showing up anywhere on the computer and any pictures showing up in the clipboard, and delete them instantaneously! That might be going too far though lol, and that would ruin the Java cross-platform option!
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If they don't want them to copy it, then perhaps they should copyright their data. That's what copyrights are for. Making it inconvenient to duplicate electronic data is one measure and making it illegal is another.
If you are dealing with criminals, they WILL find a way around whatever security measures you implement.

"Here hold my Orange Crush, but don't drink it..."
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is your duty to point out problems and inconsistencies in the design, not to be a codemonkey and just punch that keyboard...

These specs are impossible to implement fully.
As said, even if you disable toe PrtScr key there are ways to still get that screenshot or else the simplest digital camera (or any camera) can be used instead.
Therefore you should go to them and tell them that. They can then either change the requirements or give them to someone else to implement.
In either case they won't be able to blame you afterwards if the application doesn't perform to specs (someone photographs the top secret documents on the screen with his Minox for example).

Cover your you-know-what and write a position paper using the arguments outlined here (but voiced in corporate mumbo-jumbo of course) telling them basically where to stuff that requirement and that you'd be happy to implement the program if only it were dropped and you got that decision on paper (remember verbal agreements don't exist!).
 
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looking purely at the prntscrn threat, would it be possible to, at given intervals, to replace the clipboard with something benign? So if they try to paste in paint, they'll paste something useless? just a thought
 
Dmitry Melnik
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looking purely at the prntscrn threat, would it be possible to, at given intervals, to replace the clipboard with something benign?

That's quite possible with pure Java. But will not it cause problems to other apps/users which might want to use the system clipboard? Running an app which keeps polluting common resources (like the system clipboard) could be very mmm... inconvenient for others.
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Couldn't you just grab the print-screen key event and clear the clipboard at that very moment?

edit: A normal KeyAdapter doesn't pick it up. Interesting...

edit2: Correction: It works with keyReleased() , but not keyPressed()
[ August 04, 2004: Message edited by: Darin Niard ]
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Darin Niard:
Couldn't you just grab the print-screen key event and clear the clipboard at that very moment?

edit: A normal KeyAdapter doesn't pick it up. Interesting...

[ August 04, 2004: Message edited by: Darin Niard ]



that's because PrtScr doesn't give off any code which Java picks up.
Rather it gives off a hardware specific (ohoh, where have we heard about hardware specific stuff and Java?) code.
 
Darin Niard
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, oddly enough, it works only with the keyReleased() method.

I tried this, and it seems to work, unless you lose focus of course

[ August 04, 2004: Message edited by: Darin Niard ]
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Darin Niard:
Well, oddly enough, it works only with the keyReleased() method.

I tried this, and it seems to work, unless you lose focus of course



which clever people will pretty soon find out
 
Stefan Wagner
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Deleting the clipboard in a way, the user isn't used to, might be a criminal act in germany - you may damage foreign data!

And only for the illusion of some bad-informed specs-writer???
Why not format the customers harddrive, to be a bit more sure?
 
reply
    Bookmark Topic Watch Topic
  • New Topic