C# Class MouseKeyboardActivityMonitor.KeyboardState

Contains a snapshor of a keyboard state at certain moment and provides methods of querying waether specific keys are pressed or locked.
This class is basically a managed wrapper of GetKeyboardState API function http://msdn.microsoft.com/en-us/library/ms646299
Mostra file Open project: katopz/oskz-vcsharp

Public Methods

Method Description
AreAllDown ( IEnumerable keys ) : bool

Idicates weather every of specified keys were down at the moment when snapshot was created. The method returns flase if even one of them was up.

GetCurrent ( ) : KeyboardState

Makes a snapshot of a keyboard state to the moment of call and returns an instance of KeyboardState class.

IsDown ( Keys key ) : bool

Indicates wether specified key was down at the moment when snapshot was created or not.

IsToggled ( Keys key ) : bool

Indiceate weather specified key was toggled at the moment when snapshot was created or not.

Private Methods

Method Description
GetHighBit ( byte value ) : bool
GetKeyState ( Keys key ) : byte
GetLowBit ( byte value ) : bool
GetNativeState ( ) : byte[]
KeyboardState ( byte keyboardStateNative ) : System

Method Details

AreAllDown() public method

Idicates weather every of specified keys were down at the moment when snapshot was created. The method returns flase if even one of them was up.
public AreAllDown ( IEnumerable keys ) : bool
keys IEnumerable Keys to verify wether they were down or not.
return bool

GetCurrent() public static method

Makes a snapshot of a keyboard state to the moment of call and returns an instance of KeyboardState class.
public static GetCurrent ( ) : KeyboardState
return KeyboardState

IsDown() public method

Indicates wether specified key was down at the moment when snapshot was created or not.
public IsDown ( Keys key ) : bool
key Keys Key (corresponds to the virtual code of the key)
return bool

IsToggled() public method

Indiceate weather specified key was toggled at the moment when snapshot was created or not.
public IsToggled ( Keys key ) : bool
key Keys Key (corresponds to the virtual code of the key)
return bool