Thread: Check if a key has been pressed and released

  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    11

    Check if a key has been pressed and released

    I would like my application to have a while-loop that goes on as long as a certain key isn't pressed. As soon it's pressed it will make the while expression false and leave.

    I know the GetAsyncKeyState()-function but it can't see if a key has been pressed and released since it only returns the keystate when the function is called. Is there a way to find out if something has happend to a key even if it's not pressed when the function is called but instead pressed somewhere else in the loop?

    Thanks,
    Kristian

  2. #2
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    I know what your trying to do, a hook would be best.
    Last edited by Queatrix; 09-18-2006 at 12:36 PM.

  3. #3
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Although it's not easy to find good working tutorials about hooks...

  4. #4
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  2. Window message loop (Keys)
    By Blackroot in forum Windows Programming
    Replies: 3
    Last Post: 09-12-2006, 05:15 PM
  3. responsive keyboard/mouse
    By hannibar in forum C Programming
    Replies: 8
    Last Post: 02-20-2006, 12:19 PM
  4. Why only 32x32? (OpenGL) [Please help]
    By Queatrix in forum Game Programming
    Replies: 2
    Last Post: 01-23-2006, 02:39 PM
  5. LPARAM with WM_CHAR
    By Hunter2 in forum Windows Programming
    Replies: 7
    Last Post: 05-29-2002, 08:26 PM