Check if a key has been pressed and released

This is a discussion on Check if a key has been pressed and released within the Windows Programming forums, part of the Platform Specific Boards category; I would like my application to have a while-loop that goes on as long as a certain key isn't pressed. ...

  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 01: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, 06: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, 09:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21