Thread: GetAsyncKeyState() (Key pressing)

  1. #1
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039

    GetAsyncKeyState() (Key pressing)

    hey, i was wondering how i can recieve a key with GetAsyncKeyState(VK_Key), or such, so when the person holds down the button it only reacts once. for example, i say that a little picture moves a pixel right each time the right arrow key is found. but i don't want the little picture moving right 20 pixels if the user holds down the arrow key.
    thanks!

  2. #2
    The Earth is not flat. Clyde's Avatar
    Join Date
    Mar 2002
    Posts
    1,403
    Code:
    bool key = true;
    
    if (GetAsyncKeyState(VK_Key))
    {
           if (key)
           {
                   code goes here
           }
           key = false;
    }
    
    else
           key = true;

  3. #3
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039
    OH MY GOD THANK YOU!
    you are my new best friend, clyde

  4. #4
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    hehe nice post count number:

    Clyde
    The Earth is not flat.

    Registered: Mar 2002
    Location:
    Posts: 555
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  5. #5
    The Earth is not flat. Clyde's Avatar
    Join Date
    Mar 2002
    Posts
    1,403
    "OH MY GOD THANK YOU!"

    Your welcome

    "hehe nice post count number:"

    Heh the next one like that will be 666..... ominous eh =)

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