Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java and hook?  RSS feed

 
Thai C. Tran
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I need to make a program (by using Java) that when opened, user cannot switch to any other programs and do anything else (connecting to usb, ...) except interacting with my program. This is only the first stage of the development so i do not have a clear idea about what technique i will use. Window hook looks promising but i am not so sure whether i am on the right direction or not. Do you have any suggestion for this?
 
Devaka Cooray
Marshal
Posts: 5326
575
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the use of that kind of application? If I found an application like that, I will surely avoid using it.
 
Thai C. Tran
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ha ha. it is an online testing system. Nothing nasty here :d
 
Devaka Cooray
Marshal
Posts: 5326
575
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Implementation of that kind of application depends on the underlying operating system. You need to use JNI for interacting with the lower level API based on the operating system.

Moving this to Other JSE/JEE APIs forum.
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably too late, but anyway: in Windows this is next to impossible. Microsoft has spent last fifteen years trying to prevent applications exactly the behaviour you're trying to achieve (effectively locking out every other application on the system). Last occasion this was seriously possible was displaying system-modal dialog box in Windows 3.1

System hooks are nasty beasts. For starters, you'll need a DLL, for various reasons they cannot be successfully implemented in non-DLL code. Even so, some key combinations (most notably Ctrl-Alt-Del) cannot be intercepted by any other application for security reasons (otherwise keyloggers could intercept Ctrl-Alt-Del, display login screen and steal a password; you can even read this after clicking "help" in the old-style login screen in Windows XP).

With Ctrl-Alt-Del, your users can bring up the Task Manager and do pretty much anything.

Much better way (or the only way, in my opinion) is to create a very restricted user account which doesn't allow anything else than running your application. Though I don't know the details, this certainly is possible (I've been working with acounts in which even Window key+R was disallowed, preventing me to run arbitrary applications). I believe even USBs can be disabled this way. You'll just need to set up user rights and local/domain policies correctly.

If you need to run your application on computers you do not physically manage, you are probably out of luck.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!