Thread: key press

  1. #1
    Unregistered
    Guest

    key press

    Hi, i'd just like to know what message a key creates when it is pressed eg.]

    // in message que...

    case /*what here? */:
    // do something...]

    Thanks

  2. #2
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92
    WM_KEYDOWN when the key is depressed, WM_KEYUP when it is released.

    Hope this helps!

    Jeff

  3. #3
    Unregistered
    Guest
    So, if when a key is pressed, a WM_KEYDOWN message is entered into the message que, how do you test for different keys?

  4. #4
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    GetKeyState() or something.

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    From MSDN

    WM_KEYDOWN
    nVirtKey = (int) wParam; // virtual-key code
    lKeyData = lParam; // key data
    nVirtKey

    Specifies a virtual key. If the desired virtual key is a letter or digit (A through Z, a through z, or 0 through 9), nVirtKey must be set to the ASCII value of that character. For other keys, it must be a virtual-key code.

    ie VK_ESCAPE
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  6. #6
    Unregistered
    Guest
    i could find the virtual key codes for everything on the keyboard except numbers and letters. how do i find the codes for those?

  7. #7
    Registered User
    Join Date
    Aug 2001
    Location
    Melbourne, Australia
    Posts
    92
    I'd assume VK_G for g, VK_4 for 4.

    Probably not listed because they're too easy to guess :P

    -out-
    PsychoBrat
    psychobrat at gmail

  8. #8
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    >>i could find the virtual key codes for everything on the keyboard except numbers and letters. how do i find the codes for those?





    You could actually read my post.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  3. Directional Keys - Useing in Console
    By RoD in forum C++ Programming
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM
  4. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM