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 = 8 | F1 = 112 |
BREAK = 3 | F2 = 113 |
CAPSLOCK = 20 | F3 = 114 |
DEL = 46 | F4 = 115 |
DOWN = 40 | F5 = 116 |
END = 35 | F6 = 117 |
ENTER = 13 | F7 = 118 |
ESC = 27 | F8 = 119 |
HELP = 47 | F9 = 120 |
HOME = 36 | F10 = 121 |
INS = 45 | F11 = 122 |
LEFT = 37 | F12 = 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: