Thread: VK codes

  1. #1
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879

    VK codes

    Hey everyone! I'm havin a bit of trouble with my virtual-key codes. On MSDN it says that you can use VK_A - VK_Z, but whenever I try, it says that VK_(whatever letter) is an undeclared identifier. What am I missing?
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  2. #2
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    #include <windows.h>?

  3. #3
    kuphryn
    Guest
    I do not believe VK_*letter* exist. You can use static_cast<char>(...) and compare it to whatever letter you want.

    Kuphryn

  4. #4
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Ken,

    -KEN-
    Unimaginative.
    2 troo


    Kuphryn,

    Thanks! (actually, I don't need it anymore 'cuz I ditched my original idea in favour of a dialog box )
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    The virtual key codes for letters and numbers are the same as the ASCII key codes.

    Just use 'A' when you want VK_A.
    "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
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    Okee, gotcha. That's pretty much what I do anyways, but why don't VK_ letters work?
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  7. #7
    Registered User canine's Avatar
    Join Date
    Sep 2001
    Posts
    125
    i had the same problem so i just used the hex
    In a perfect world every dog would have a home and every home would have a dog.
    Visit My Web Site, Canine Programming
    I use Win32 API

  8. #8
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    I remember trying that and it not working... probably made a mistake tho.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  9. #9
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    >>but why don't VK_ letters work?

    I could not find a #define for them as I could for the other VK_'s.

    The comment next to VK_'s defines was to use the ASCII codes.
    "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

  10. #10
    Registered User Dcower's Avatar
    Join Date
    Aug 2002
    Posts
    8

    Post

    I just made my own header file. I've attached it to this post...

  11. #11
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    I don't think that'll be necessary. Ascii codes work fine for me!

    BTW, I brought up the subject 'cuz I wanted to use GetKeyboardState(), but I couldn't figure out which key was pressed (and I wanted to figure it out, so I could have the user type in a message That won't be necessary, since I've gone with a dialog box instead.)
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. codes
    By IfYouSaySo in forum A Brief History of Cprogramming.com
    Replies: 34
    Last Post: 11-18-2005, 03:09 PM
  2. Replies: 1
    Last Post: 07-12-2005, 09:03 PM
  3. action replay codes
    By c++.prog.newbie in forum Game Programming
    Replies: 2
    Last Post: 02-28-2004, 08:47 AM
  4. Key codes for non-number/letter keys
    By Hunter2 in forum Windows Programming
    Replies: 0
    Last Post: 02-18-2003, 08:34 PM