C# Class WindowsInput.KeyboardSimulator

Implements the IKeyboardSimulator interface by calling the an IInputMessageDispatcher to simulate Keyboard gestures.
Inheritance: IKeyboardSimulator
Datei anzeigen Open project: Hebo/LeagueMaster Class Usage Examples

Public Methods

Method Description
KeyDown ( VirtualKeyCode keyCode ) : void

Calls the Win32 SendInput method to simulate a KeyDown.

KeyPress ( VirtualKeyCode keyCode ) : void

Calls the Win32 SendInput method with a KeyDown and KeyUp message in the same input sequence in order to simulate a Key PRESS.

KeyUp ( VirtualKeyCode keyCode ) : void

Calls the Win32 SendInput method to simulate a KeyUp.

KeyboardSimulator ( ) : System

Initializes a new instance of the KeyboardSimulator class using an instance of a WindowsInputMessageDispatcher for dispatching INPUT messages.

KeyboardSimulator ( IInputMessageDispatcher messageDispatcher ) : System

Initializes a new instance of the KeyboardSimulator class using the specified IInputMessageDispatcher for dispatching INPUT messages.

ModifiedKeyStroke ( IEnumerable modifierKeyCodes, IEnumerable keyCodes ) : void

Simulates a modified keystroke where there are multiple modifiers and multiple keys like CTRL-ALT-K-C where CTRL and ALT are the modifierKeys and K and C are the keys. The flow is Modifiers KeyDown in order, Keys Press in order, Modifiers KeyUp in reverse order.

ModifiedKeyStroke ( IEnumerable modifierKeyCodes, VirtualKeyCode keyCode ) : void

Simulates a modified keystroke where there are multiple modifiers and one key like CTRL-ALT-C where CTRL and ALT are the modifierKeys and C is the key. The flow is Modifiers KeyDown in order, Key Press, Modifiers KeyUp in reverse order.

ModifiedKeyStroke ( VirtualKeyCode modifierKey, IEnumerable keyCodes ) : void

Simulates a modified keystroke where there is one modifier and multiple keys like CTRL-K-C where CTRL is the modifierKey and K and C are the keys. The flow is Modifier KeyDown, Keys Press in order, Modifier KeyUp.

ModifiedKeyStroke ( VirtualKeyCode modifierKeyCode, VirtualKeyCode keyCode ) : void

Simulates a simple modified keystroke like CTRL-C where CTRL is the modifierKey and C is the key. The flow is Modifier KeyDown, Key Press, Modifier KeyUp.

TextEntry ( string text ) : void

Calls the Win32 SendInput method with a stream of KeyDown and KeyUp messages in order to simulate uninterrupted text entry via the keyboard.

Private Methods

Method Description
SendSimulatedInput ( INPUT inputList ) : int

Sends the list of INPUT messages using the IInputMessageDispatcher instance.

Method Details

KeyDown() public method

Calls the Win32 SendInput method to simulate a KeyDown.
public KeyDown ( VirtualKeyCode keyCode ) : void
keyCode VirtualKeyCode The to press
return void

KeyPress() public method

Calls the Win32 SendInput method with a KeyDown and KeyUp message in the same input sequence in order to simulate a Key PRESS.
public KeyPress ( VirtualKeyCode keyCode ) : void
keyCode VirtualKeyCode The to press
return void

KeyUp() public method

Calls the Win32 SendInput method to simulate a KeyUp.
public KeyUp ( VirtualKeyCode keyCode ) : void
keyCode VirtualKeyCode The to lift up
return void

KeyboardSimulator() public method

Initializes a new instance of the KeyboardSimulator class using an instance of a WindowsInputMessageDispatcher for dispatching INPUT messages.
public KeyboardSimulator ( ) : System
return System

KeyboardSimulator() public method

Initializes a new instance of the KeyboardSimulator class using the specified IInputMessageDispatcher for dispatching INPUT messages.
If null is passed as the .
public KeyboardSimulator ( IInputMessageDispatcher messageDispatcher ) : System
messageDispatcher IInputMessageDispatcher The to use for dispatching messages.
return System

ModifiedKeyStroke() public method

Simulates a modified keystroke where there are multiple modifiers and multiple keys like CTRL-ALT-K-C where CTRL and ALT are the modifierKeys and K and C are the keys. The flow is Modifiers KeyDown in order, Keys Press in order, Modifiers KeyUp in reverse order.
public ModifiedKeyStroke ( IEnumerable modifierKeyCodes, IEnumerable keyCodes ) : void
modifierKeyCodes IEnumerable The list of modifier keys
keyCodes IEnumerable The list of keys to simulate
return void

ModifiedKeyStroke() public method

Simulates a modified keystroke where there are multiple modifiers and one key like CTRL-ALT-C where CTRL and ALT are the modifierKeys and C is the key. The flow is Modifiers KeyDown in order, Key Press, Modifiers KeyUp in reverse order.
public ModifiedKeyStroke ( IEnumerable modifierKeyCodes, VirtualKeyCode keyCode ) : void
modifierKeyCodes IEnumerable The list of modifier keys
keyCode VirtualKeyCode The key to simulate
return void

ModifiedKeyStroke() public method

Simulates a modified keystroke where there is one modifier and multiple keys like CTRL-K-C where CTRL is the modifierKey and K and C are the keys. The flow is Modifier KeyDown, Keys Press in order, Modifier KeyUp.
public ModifiedKeyStroke ( VirtualKeyCode modifierKey, IEnumerable keyCodes ) : void
modifierKey VirtualKeyCode The modifier key
keyCodes IEnumerable The list of keys to simulate
return void

ModifiedKeyStroke() public method

Simulates a simple modified keystroke like CTRL-C where CTRL is the modifierKey and C is the key. The flow is Modifier KeyDown, Key Press, Modifier KeyUp.
public ModifiedKeyStroke ( VirtualKeyCode modifierKeyCode, VirtualKeyCode keyCode ) : void
modifierKeyCode VirtualKeyCode The modifier key
keyCode VirtualKeyCode The key to simulate
return void

TextEntry() public method

Calls the Win32 SendInput method with a stream of KeyDown and KeyUp messages in order to simulate uninterrupted text entry via the keyboard.
public TextEntry ( string text ) : void
text string The text to be simulated.
return void