2024年4月16日发(作者:)

虚拟键盘值表(Virtual keyboard value table)

Keyboard virtual key encoding table using keybd_Ev

Analog keyboard input, first of all to use a API function:

keybd_event.

We are new, so we don't have to understand the details. Just

use the following method! Ha-ha!

The analog button has two basic actions, that is, press the key

and release the button, so we call the two API function every

time we simulate the button:

Example 1: simulate pressing the'A'key

Keybd_event (65,0,0,0);

Keybd_event (65,0, KEYEVENTF_KEYUP, 0);

Example 2: simulate pressing the'ALT+F4'key

Keybd_event (18,0,0,0);

Keybd_event (115,0,0,0);

Keybd_event (115,0, KEYEVENTF_KEYUP, 0);

Keybd_event (18,0, KEYEVENTF_KEYUP, 0);

Example 3: empty the screen before pressing a program (press

Win +D)

[DllImport ("")]

Public, static, extern, void, keybd_event (Byte, bVk, Byte,

bScan, Int32, dwFlags, Int32, dwExtraInfo);

Keybd_event (0x5b, 0, 0, 0);

Keybd_event (68, 0, 0, 0);

Keybd_event (0x5b, 0, 0x2, 0);

Keybd_event (68, 0, 0x2, 0);

Attached: commonly used analog key key table.

Keyboard key and virtual key code comparison table

Letters and numbers keys, keys, keys, keys, other keys

Key, code key, key code, key key, code key, key code

A 65096, F1 112, Backspace 8

B 66197, F2 113, Tab 9

C 67298, F3 114, Clear 12

D 68399, F4 115, Enter 13

E 694100, F5 116, Shift 16