Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Preventing the Windows logo key from activating the Windows Start menu...

 
Joe Vahabzadeh
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All,

Ok, I'm working with capturing/intercepting keystrokes in Java.

My class extends JPanel, has a key listener, and gets the keyPressed, keyTyped, and keyReleased events. I've managed to get most stuff working so that even international keys (ie: on Japanese keyboards) work right.

I've also, in the constructor, used the following:

this.enableInputMethods(false);
this.setFocusTraversalKeysEnabled(false);

My problem is with the Windows Logo key (which generates keyCode VK_WINDOWS, or 524). I can capture the keystroke, but can't figure out how to prevent the Start menu from opening up.

Anyone have any idea how I can accomplish this? Is it possible? Thanks in advance.
 
Torgil Zethson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm pretty sure this is not possible in Java. You might be able to do it using JNI.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I find that a pen-knife works exceedingly well on the "Windows" key. Pry it off, put it in a drawer. I have quite a few of them.
 
Joe Vahabzadeh
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Torgil Zethson:
I'm pretty sure this is not possible in Java. You might be able to do it using JNI.


Bummer. For the project I'm working on, JNI isn't permitted (the software has to run on any operating system).

Originally posted by Ernest Friedman-Hill:
I find that a pen-knife works exceedingly well on the "Windows" key. Pry it off, put it in a drawer. I have quite a few of them.


You don't know how badly I wish I could do that sometimes!
 
Paul Clapham
Sheriff
Pie
Posts: 20756
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is that really a problem? After all, your application can never be sent that keystroke, can it?
 
Joe Vahabzadeh
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as a matter of fact, it can. And does.

Our goal, ideally, is that we capture everything and send it along to the remote system. So far, the only problem is the Windows Logo key, which we do capture an send to the remote system, but can't prevent the client system from responding to, if it's a Windows OS.
 
Torgil Zethson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The best 100% Java solution I can think of is to display a popup message, asking the user not to press the Windows key again...
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
! "Stop that you !"

[Edited to be a little less unfriendly]
[ December 23, 2005: Message edited by: David Weitzman ]
 
Joe Vahabzadeh
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
LOL! Don't tempt me.....
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ken Blair:
! "Stop that you !"

[Edited to be a little less unfriendly]

[ December 23, 2005: Message edited by: David Weitzman ]


But it's supposed to be unfriendly! Damn users, who do they think they are using our software! Damn them all!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic