Skip to main content

Keyboard

The KeyBoard object for the virtual user that can be used to directly send key down and key up actions.

This may be required for actions that are not available with the SendKeys method.

void KeyDown(int keyCode, int pause);
void KeyUp(int keyCode, int pause);

Parameters

keyCode: The ID of the key to press.

pause: The time to wait in milliseconds before depressing/releasing the key.

Return Value

None

Remarks

KeyDown - Depresses a key on the keyboard.

KeyUp - Releases a key on the keyboard.

Valid Values for keyCode
BACKSPACE = 8F1 = 112
BREAK = 3F2 = 113
CAPSLOCK = 20F3 = 114
DEL = 46F4 = 115
DOWN = 40F5 = 116
END = 35F6 = 117
ENTER = 13F7 = 118
ESC = 27F8 = 119
HELP = 47F9 = 120
HOME = 36F10 = 121
INS = 45F11 = 122
LEFT = 37F12 = 123
LMENU = 164
LWIN = 91
NUMLOCK = 144
PGDN = 34
PGUP = 33
PRTSC = 44
RIGHT = 39
RMENU = 165
RWIN = 92
SCROLLLOCK = 145
SPACE = 32
TAB = 9
UP = 38

Example

// depress the backspace key
KeyDown(8,768);

Related: