Share via


Key Identifiers Reference

The Key Identifiers Reference lists the valid key identifiers used to simulate keystrokes in a virtual machine.

Both the IVMKeyboard and IVMRCClientControl interfaces use these key identifiers to simulate individual keystrokes or in creating key sequence strings.

A key sequence string is a comma-delimited set of key identifiers which are used to simulate the key press and release sequence of a standard U.S. 101-key AT-style keyboard.

If a key identifier appears in the string without a preceding modifier, a key-pressed code is simulated, followed immediately by its corresponding key-released code. Key modifiers can be used to change this behavior.

For example, the DOWN modifier will send the key-pressed code for the following key identifier without sending the key-released code. This is useful for simulating Ctrl, Alt, and Shift keys when they are held down while other keys are being sent. To release the key, it must be included in the key string again along with a preceding UP modifier.

The following list details the valid key identifier strings.

Key identifier string Meaning
Key_Escape the Esc key
Key_F1 the F1 key
Key_F2 the F2 key
Key_F3 the F3 key
Key_F4 the F4 key
Key_F5 the F5 key
Key_F6 the F6 key
Key_F7 the F7 key
Key_F8 the F8 key
Key_F9 the F9 key
Key_F10 the F10 key
Key_F11 the F11 key
Key_F12 the F12 key
Key_SysReq the SysReq key
Key_ScrollLock the ScrollLock key
Key_Break the Break key
Key_LeftApostrophe the ` key
Key_1 the 1 key
Key_2 the 2 key
Key_3 the 3 key
Key_4 the 4 key
Key_5 the 5 key
Key_6 the 6 key
Key_7 the 7 key
Key_8 the 8 key
Key_9 the 9 key
Key_0 the 0 key
Key_Hyphen the - key
Key_Equals the = key
Key_Backspace the Backspace key
Key_Insert the Ins key
Key_Home the Home key
Key_PageUp the PageUp key
Key_NumLock the NumLock key
KeyPad_Divide the / key on the keypad
KeyPad_Multiply the * key on the keypad
KeyPad_Minus the - key on the keypad
Key_Tab the Tab key
Key_Q the Q key
Key_W the W key
Key_E the E key
Key_R the R key
Key_T the T key
Key_Y the Y key
Key_U the U key
Key_I the I key
Key_O the O key
Key_P the P key
Key_LeftBracket the [ key
Key_RightBracket the ] key
Key_Backslash the \ key
Key_Delete the Delete key
Key_End the End key
Key_PageDown the PageDown key
KeyPad_7 the 7 key on the keypad
KeyPad_8 the 8 key on the keypad
KeyPad_9 the 9 key on the keypad
KeyPad_Plus the + key on the keypad
Key_A the A key
Key_S the S key
Key_D the D key
Key_F the F key
Key_G the G key
Key_H the H key
Key_J the J key
Key_K the K key
Key_L the L key
Key_SemiColon the ; key
Key_SingleQuote the ' key
Key_Enter the Enter key
KeyPad_4 the 4 key on the keypad
KeyPad_5 the 5 key on the keypad
KeyPad_6 the 6 key on the keypad
Key_LeftShift the Left Shift key
Key_Z the Z key
Key_X the X key
Key_C the C key
Key_V the V key
Key_B the B key
Key_N the N key
Key_M the M key
Key_Comma the , key
Key_Period the . key
Key_Slash the / key
Key_RightShift the Right Shift key
Key_Up the Up key
KeyPad_1 the 1 key on the keypad
KeyPad_2 the 2 key on the keypad
KeyPad_3 the 3 key on the keypad
KeyPad_Enter the Enter key on the keypad
Key_LeftCtrl the Left Ctrl key
Key_LeftWindows the Left Windows key
Key_LeftAlt the Left Alt key
Key_Space the Space key
Key_RightAlt the Right Alt key
Key_RightWindows the Right Windows key
Key_RightCtrl the Right Ctrl key
Key_Application the Application key
Key_Left the Left key
Key_Down the Down key
Key_Right the Right key
KeyPad_0 the 0 key on the keypad
KeyPad_DecimalPoint the . key on the keypad

 

The following list details the valid key modifier strings.

Key modifier string Meaning
DOWN Send a key-pressed code for the following key identifier without sending a key-released code.
UP Send a key-released code for the following key identifier.
HOLD Pause 200 milliseconds before continuing to process the remainder of the key sequence string.

 

Example Code

The following C++ example simulates typing "Hello World!" in a virtual machine session.

BSTR bHello=SysAllocString(L"DOWN,Key_LeftShift,Key_H,UP,"
              "Key_LeftShift,Key_E,Key_L,Key_L,Key_O,Key_Space,DOWN,"
              "Key_LeftShift,Key_W,UP,Key_LeftShift,Key_O,Key_R,Key_L,"
              "Key_D,DOWN,Key_LeftShift,Key_1,UP,Key_Left_Shift");

HRESULT hr =  pIVMKeyboard->TypeKeySequence(bHello);
SysFreeString(bHello);

IVMKeyboard

IVMKeyboard::TypeKeySequence

IVMRCClientControl

IVMRCClientControl::SendKeySequence