How do you override the WINDOWS key?

I'm writing or rather rewriting a game. I would like to override the windows key to do some function in the game without invoking the windows menu. Is this possible, and if so how?
Below is a sample bit of code I used to see what key codes, locations, and events were fired while pressing various keys. I made the key pressed/typed/released methods consume the events in an attempt to block the windows menu from coming up. I tried using a KeyEventDispatcher to catch all key events and consume them there, but it still displays the windows menu (on Windows 2000 at least).
I have searched the forums and the all mighty Google to no avail. Please help me if you can. Thank you.
import java.awt.Dimension;
import java.awt.KeyEventDispatcher;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.FocusManager;
import javax.swing.JFrame;
public class Test extends JFrame implements KeyListener, KeyEventDispatcher
  public Test()
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    addWindowListener(new WindowAdapter()
      @Override
      public void windowClosing(WindowEvent windowEvent)
        System.exit(0); //close all windows and exit
    FocusManager.getCurrentManager().addKeyEventDispatcher(this);
    this.addKeyListener(this);
    this.pack();
  public static void main(String[] arguments)
    Test frame;
    frame = new Test();
    frame.setTitle("Test Frame");
    frame.setPreferredSize(new Dimension(200,200));
    frame.invalidate();
    frame.pack();
    frame.setVisible(true);
  // this doesn't stop windows key from being processed whether true or false
  // if it is true the keyPressed, keyTyped, and keyReleased don't get called
  public boolean dispatchKeyEvent(KeyEvent keyEvent)
    System.out.println("dispatchKeyEvent " + keyEvent);
    return true;
  public void keyPressed(KeyEvent keyEvent)
    System.out.println("keyPressed " + keyEvent);
    keyEvent.consume();
  public void keyReleased(KeyEvent keyEvent)
    System.out.println("keyReleased " + keyEvent);
    keyEvent.consume();
  public void keyTyped(KeyEvent keyEvent)
    System.out.println("keyTyped " + keyEvent);
    keyEvent.consume();
}

Thanks for the reply. That is basically all I wanted to confirm. I wanted to allow the player to redefine the windows key to some game specific command. I can do this for all of the other keys I was able to test except for that one.
If someone uses it on something other than windows they can redefine any key that maps to one of theirs. Since I don't have any alternate systems or keyboards to test on I won't bother making other keyboard configurations for the time being, if ever.

Similar Messages

  • How do you change the shortcut keys for Firefox in Welsh For Mac?

    I'm using Firefox in Welsh on Mac (asking in English to hopefully get more answers), and every time I try to do the shortcut for copy (cmd+C), it hides the window (since Hide in Welsh is Cuddio, the shorcut for that is now Cmd+C). I usually forget this, and proceed with using the shortcut for copy only to anger myself when I realise that I've hidden the window.
    My question is, how do you change the shortcut keys on Firefox so then I can change the Hide shortcut and give Copy the cmd+C shortcut? I'm also using OpenOffice.org in Welsh, and they are using cmd+C for copy and cmd+H for Hide.
    Is there any way that I could do this myself? Its rather annoying for me, and its rather weird to use Cmd+X for Cutting text instead of copying.
    Thanks.

    This could be worth a bug. It shouldn't happen that some shortcut keys get (re)used for other actions and Cmd + C should be considered as one of them.
    You can try to make the change in this file: cy.jar/locale/browser/baseMenuOverlay.dtd
    <pre><nowiki><!ENTITY hideThisAppCmdMac.label "Cuddio &brandShortName;">
    <!ENTITY hideThisAppCmdMac.commandkey "C"></nowiki></pre>
    English language pack: en-GB.jar/locale/browser/baseMenuOverlay.dtd
    <pre><nowiki><!ENTITY hideThisAppCmdMac.label "Hide &brandShortName;">
    <!ENTITY hideThisAppCmdMac.commandkey "H"></nowiki></pre>
    You can find the file cy.jar in the chrome folder in the Firefox application folder.<br />
    The file cy.jar is a ZIP archive, so you need a program that can open such an archive and edit the file baseMenuOverlay.dtd.
    I'm not on a Mac, so can't do any testing in this matter. I just downloaded the Welsh (cy.xpi) language pack for Mac and had a look in it.

  • How do you get the Windows side on a Mac?

    How do you get the Windows side on a Mac?

    There is no Windows side on a Mac unless you install a version of Windows in a virtual machine or use Boot Camp to partition the drive and install Win 7 (if you are using a Macbook Pro that came with OS X Lion installed).
    If you use a virtual machine you can install just about any version of Windows that you have a retail disc of and a legal license key to go with it.

  • HOW DO YOU CHANGE THE WINDOW SIZE OF EBUSINESS SUITE ON STARTUP

    HOW DO YOU CHANGE THE WINDOW SIZE OF EBUSINESS SUITE ON STARTUP
    How do you change the window size for Ebusiness Suite after you log in. Currently it displays at 100% of the screen. I want to set it smaller, at some %

    I don't know if there is a way to set this. Some user's may prefer different sizes of window, depending on their job duties. For example, we have 170 Systems document management integrated with purchasing and payables so users shrink the Oracle window to fill about 60% of the screen while 170 uses the remaining 40% to display the scanned document.

  • HT1343 How do you replace the dollar key for the british pound

    How to you replace the dollar sign with the british pound.

    HI,
    In System Preferences > Language and Text > Input Source tab choose the British Keyboard option.
    8:28 PM      Thursday; August 29, 2013
      iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.4)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • How do you remap the Fn key on windows for gaming?

    As many of you know on the macbook pro the bottom row of keys is in this order: [fn][control][alt][command] instead of the more logical [control][fn][alt][command]. This can be a huge problem in gaming which requires the use of the control key. Most remapping programs I have tried (in Windows 7) do not recognise the fn key neither do the games themselves when you try to change the keyboard setup. Is there any solution to this problem? You will be helping mac gamers everywhere!

    According to this: [[Keyboard shortcuts]], it is not possible.

  • How do you get the hot keys / keyboard shortcuts to work?

    I have the free trial version of Photoshop. I am new to Photoshop, I am just starting to learn how to use it. I notice that some of the shortcuts/hot keys don't work.
    For example, one basic hot key that does not work is the F7-key. The F7-key opens and closes the layers palette.
    Another hot key that does not work is the spacebar. My teacher taught me to hold the spacebar down when you want to move the canvas around. When I am in handtool mode I hold the spacebar down, I then apply pressure on my laptops touchpad, I then slide my finger across my laptops touchpad in order to try and move the canvas, but the canvas does not budge.
    Some shortcuts work. For example, tapping the F-key multiple times will expand and reduce the size of Photoshop.
    Closing my web browser did not resolve the problem. Updating the software did not resolve the problem.
    I am eager to learn Photoshop, but it's hard, and probrably a waste of time, to try and learn Photoshop when some of the softwares hot keys don't work. Anyone have a solution they can offer?
    Thank you,
    Jennifer
    Toshiba X75 / Windows 8 / i7-4700MQ / GeForce GTX770M / 32GB RAM

    hello.. i want to ask your something about your laptop... i am actually planing to buy new laptop.Toshiba X75 or MSI GS70 .. i am not gammer. never play game on laptop last 6 years... my laptop 24hrs on.. and i do design...  so how is your Toshiba X75 performance for designing.. i read on internet. Toshiba X75 have overheating problem.. but the people complain most of them gammer... as i don't play game on laptop.. will i face same thing ?

  • How Do You Send the END KEY via Serial?

    Hello All,
    I'm trying to do something that would seem simple, but is not because almost no information about the END KEY on keyboards is posted online.  Essentially, I'm trying to activate a device that comes out of sleep when someone presses the END KEY through hyperterminal or some ascii based command window.  I'm trying to send that END KEY automatically using Labview, but I'm stuck. So here are my questions.
    Does the END KEY have a specific ASCII number?  I'm getting 2 different answers in my search for this one.
    If it doesn't, how do I send that command over the serial communications line?
    If it does, then what's the best way to convert it to something that labview understands as the END KEY, and not some combo of characters?
    Thanks a bunch.
    Matt

    You would have to find out the character that is mapped to the END key and simply send that out the serial port. You may want to try sending 0x4f". At least this is what I found for the mapping of the END key.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • How do you use the windows User32.dll Library functions to read variables from other applications that are running

    I am trying to read a text box from a programme running at the same time as my Labview application using calls to the Windows
    User32.dll. I believe I need to find the window handle for the 'form' containing this text string and use this together with
    various other defined input variables to access the sting.
    I have no experience of using this 'Call Library Function Node', but have an understanding of the 'C' programming language. Does anyone have
    example Labview code showing how this might be done.
    Thanks

    If you're trying to access information that's being displayed in the window of another application and that application has no ActiveX interface, then yes, Windows calls can be used. There's a very good example on calling DLLs that ship with LabVIEW. Open the Example Finder (Help->Find Examples) and switch to the Search tab. Enter "Call" in the search box and open the VI "Call DLL". Run the VI, select any of the examples, and click the "Open Example VI..." button. That shows you how to call a DLL.
    Now, given that you have no experience in calling DLLs, have only an "understanding" of C (which to me means you have never written something like a DLL), and don't seem to know that much about what Windows functions you may need, you're going to find this route pretty difficult, especially since you have to deal with Windows API calls, which are not always that easy to do from LabVIEW.
    Let me propose an alternate solution. Go over to http://www.autoitscript.com/autoit3/ and download AutoIt. This is an automation tool that allows you to automate just about anything you want. It has an ActiveX interface that you can call from LabVIEW. I've attached an example VI that shows you how to use it to get the value of a text box from one of the tabs in the computer "System Properties" control panel applet.
    Attachments:
    AutoIt Example (v7).vi ‏25 KB

  • How do you minimize the window when the top of the page is above screen height in ubuntu 12.04, so I can't see the tabs, let alone using the normal minimize

    Hi there, every now and then when i maximixe or minimize a window. The top of the window is above the screen so I am unable to see the tabs or anything above the address bar, is the a way to minimize using the menu, or a configuration file I can alter to stop it going above the top of the screen. It's a pain having to restart the system / firfox when you have a handfull of tabs open while researching and then having to remember which sites you had open to reopen them. thanks

    Use the F11 key or move the mouse pointer to the top of the screen.
    I am using Ubuntu 12.0.4 with various versions of Firefox installed, I think that works with them all.
    * [[Keyboard shortcuts - Perform common Firefox tasks quickly#w_miscellaneous]]_miscellaneous

  • How do you disable the shortcut key in Mail that deletes all mail in the trash folder

    Is there a way to disable the shortcut key in Mail in Mountain Lion that deletes all mail in the Trash folder in all accounts: <shift><command><delete> ?
    I did it once by mistake and it deleted all my trash - it is very difficult to restore when there are thousands of messages in various emaiil accounts.
    Thanks

    While you can't (so far as I know) remove it - you can assign a different (& less likely to be used accidentally) one via System Preferences - Keyboard - Shortcuts.
    Go there, create a new one (or 2) for Mail only, and give it the exact name(s) if the menu item(s) in question, capitalisation & ... included.
    Below is on 10.6, but the idea's the same

  • How do you remap the F1 key to paste your email address into a textbox on a website?

    I would like to know if FIREFOX allows keys to be remapped. I want to be able to make the F1 key paste my email address into a textbox on a website to make it easier to type stuff. I have seen other programs that allow you to "remap" the keyboard and I wanted to know if FIREFOX allows this or not?

    According to this: [[Keyboard shortcuts]], it is not possible.

  • HT4818 how do you install the windows 7 drivers for a mac os x 10.8.2?

    I have this question because the instructions say you need to use the CD/DVD included in the box my macbook pro came in... but mine did not come with any CD... so where can I find it?

    When you start Boot Camp Assistant one of the first menu items is to download the Windows Support software. Did you do this step?
    The instructions you read and are referring to are for Snow Leopard and older computers that came with an operating system DVD.
    You should also visit the Boot Camp forum where your question has been answered many times. https://discussions.apple.com/community/windows_software/boot_camp

  • How do you find the wep key for the wifi?

    I need the WEP key to be able to acess my wifi through my playstation. And i am unsure of which operating system to choose i know i have the most up to date one though

    Is the Wi-Fi network, provided by your AirPort Extreme, configured for WEP wireless encryption? If not, and is using WPA or WPA2 instead, then the Playstation is not properly recognizing the security type.
    Which exact version of the Extreme do you have?
    By operating system, are you referring to the one you are running on your computer? Is so, what is the make & model of your computer?

  • How do you get the product key for your new Satellite C55-B5202?

    I recently bought this new laptop and for the love of God I can't use Microsoft Office cause it keeps asking me for a product key. Please tell me how do I retrieve it! It did not come with a CD, there is no sticker at the bottom of the laptop or the box itself.
    Solved!
    Go to Solution.

    Satellite C55-B5202
    According to the spec above, you have a "1 month trial for new Office 365 customers." When the trial ends, you’ll be prompted to choose which version of Office you want to purchase.
    Microsoft Office has never been free.
    -Jerry

Maybe you are looking for

  • How do I see which apps I`ve paid for?

    Hi all! I was looking online at my bank account just now and saw that I have money coming out for two apps (both $1, not too big of a deal) however, I don`t recall purchasing any apps (I stick with free ones, for the most part) and no one else has my

  • Webforms - data handling and storage

    Hello, I would like to know what is the best recommended practice / best apps methodology for the following scenario : A Custom web form with options to enter data, add attachments and submit. On submission , the workflow gets triggered, followed by

  • EJB adapter configured in Jdev is not reflecting in Oracle BPM References

    Hi All, I have configured an EJB service adapter in Oracle Jdeveloper in external references swim lane to call it from Oracle BPM workflow/process. But, that is not getting reflected in Oracle BPM process "References(folder)" in Business catalog. I d

  • IDOCXMLtoFileConvertor Exception

    Hi, Can someone please let me know the reason for below exception for IDOC XML converter. Message processing failed. Cause: com.sap.conn.idoc.IDocParseException: (7) IDOC_ERROR_PARSE_FAILURE: The metadata for the parsed IDoc was not available. See ca

  • Error installing recovery catalog

    Hi, Inorder to implement RMAN in oracle 10g in windows environment I created a separate table space for rman and created a user as rman1; then I issued the following commands : GRANT connect, resource, recovery_catalog_owner TO rman1 grant create ses