get key state

  • Thread starter Thread starter Lloyd Dupont
  • Start date Start date
L

Lloyd Dupont

I would like to know the state of the keyboard.
more precisely I would like to know if the 'SPACE' key is pressed or not.
how od I do that?

--
Regards,
Lloyd Dupont

NovaMind development team
NovaMind Software
Mind Mapping Software
<www.nova-mind.com>
 
Found it:
[SuppressUnmanagedCodeSecurity]
public class KeyState
{
[DllImport("user32.dll")]
static extern short GetKeyState(int nVirtKey);
public static bool GetKeyPressed(Keys key)
{
short state = GetKeyState((int) key);
return state != 0;
}

Just a bit disappointed the Keyboard class doesn't return it...
 
Back
Top