aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Preventing the Windows logo key from activating the Windows Start menu... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Preventing the Windows logo key from activating the Windows Start menu..." Watch "Preventing the Windows logo key from activating the Windows Start menu..." New topic
Author

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

Joe Vahabzadeh
Ranch Hand

Joined: Jan 05, 2005
Posts: 140
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

Joined: Nov 30, 2005
Posts: 9
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

Joined: Jul 08, 2003
Posts: 24187
    
  34

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.


[Jess in Action][AskingGoodQuestions]
Joe Vahabzadeh
Ranch Hand

Joined: Jan 05, 2005
Posts: 140
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
Bartender

Joined: Oct 14, 2005
Posts: 18656
    
    8

Is that really a problem? After all, your application can never be sent that keystroke, can it?
Joe Vahabzadeh
Ranch Hand

Joined: Jan 05, 2005
Posts: 140
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

Joined: Nov 30, 2005
Posts: 9
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

Joined: Jul 15, 2003
Posts: 1078
! "Stop that you !"

[Edited to be a little less unfriendly]
[ December 23, 2005: Message edited by: David Weitzman ]
Joe Vahabzadeh
Ranch Hand

Joined: Jan 05, 2005
Posts: 140
LOL! Don't tempt me.....
Ken Blair
Ranch Hand

Joined: Jul 15, 2003
Posts: 1078
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Preventing the Windows logo key from activating the Windows Start menu...