Re: Detecting a key pressed at startup

From: Christakis John (dontemail_at_me.please.ok)
Date: 01/17/05


Date: Mon, 17 Jan 2005 05:57:27 GMT


> The easy way to check key-downs is to use the Win API call GetKeyState().
This
> takes a "virtual-key" value (look that up, or Find a topic in Win32 help)
of
> the key and returns a negative value if the key is down.
>

Hi,

I have had a play with this and found a problem, the documentation says:

The GetKeyState function retrieves the status of the specified virtual key.
The status specifies whether the key is up, down, or toggled (on, off -
alternating each time the key is pressed).

the problem is the 'on, off - alternating each time the key is pressed'
part - using this function only works every 2nd time. How can I get the key
state as a boolean of it being pressed or not? I would like this in the
onClick event of a button.

tia,
cj


Quantcast