File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes How to disable keyboard input Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to disable keyboard input" Watch "How to disable keyboard input" New topic

How to disable keyboard input

Marx Villegas
Ranch Hand

Joined: Mar 10, 2006
Posts: 94
I'm developing a cybercafe management client/server application, and I have a very hard task in hand.
I need that clients machines, when unauthorized to be used, have both mouse and keyboard disabled, while the screen shows nothing but a "Welcome to the cyber - for navigating contact cyber operator", absolutely nothing else. Then when the operator authorizes the machine, OS is shown.
The idea is to make a multiplaform app for both client and server.

I already know how to freeze the screen, but when the user presses alt+ctrl+delete, or alt+tab, or the windows OS start key my magic window dissapears. I already implemented the KeyListener interface and captured and consumed all the keyboard events, and it still won't work.

Help me please, I'm kinda desperate

When the compiler's not happy, ain't nobody happy...
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

You won't be able to do this in pure Java; you'll need to use heavy Windows native-code voodoo, especially to block Ctrl-Alt-Delete.

[Jess in Action][AskingGoodQuestions]
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
I thought it was supposed to be genuinely impossible to intercept Ctrl-Alt-Del in Windows. The idea is to prevent trojans. Don't take this as Gospel, though; I could be wrong.

You may have better luck with Alt-Tab.

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Marx Villegas
Ranch Hand

Joined: Mar 10, 2006
Posts: 94
Thanks a lot! I'll figure something else out
Marx Villegas
Ranch Hand

Joined: Mar 10, 2006
Posts: 94
It is possible to catch the ALT+CTRL+DEL and a whole bunch of windows OS's magical keystrokes: Microsoft Visual C++ makes it possible.
Do you think it is a good idea to use native methods in my java project?
I would do it all in java, but the ALT+CTRL+DEL enable/disable routines in C++. Is it possible? is it viable? Is it a good or bad idea?
[ June 30, 2006: Message edited by: Marx Villegas ]
Ken Blair
Ranch Hand

Joined: Jul 15, 2003
Posts: 1078
Given we have very limited information about the context and requirements it's hard to make such a sweeping judgement. It's certainly possible and probably beneficial. Instead of having 'native methods' you can use JNI instead. Write the bulk of the project in Java and call native programs where it's needed.
Marx Villegas
Ranch Hand

Joined: Mar 10, 2006
Posts: 94
Thank you Ken. I'm actually using JNI, and I've fought C++ all day long.
I'll get the code published as soon as I finish it.
Thank you all
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
Why reinvent the wheel? You could find many opensource cybercafe softwares (written in java) at

MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
sabin ran

Joined: Aug 06, 2010
Posts: 22
hey can anybody help me? while searching for solution i end up here. i am trying to make screen locker within the college management system in java where only correct password will unlock it. please help
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15087

The same thing that was true in 2006 is still true today: you cannot do this with pure Java; you'll need to program native code for your operating system to do this.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
I agree. Here's the link:
subject: How to disable keyboard input
jQuery in Action, 3rd edition