IVMKeyboard::TypeKeySequence method
The TypeKeySequence method simulates the given series of keys being typed (pressed and then released) inside the virtual machine.
Syntax
HRESULT TypeKeySequence(
[in] BSTR keySequence
);
Parameters
-
keySequence [in]
-
The comma-delimited sequence of key codes to be typed inside the virtual machine.
Return value
This method can return one of these values.
Return code | Description |
---|---|
|
The operation was successful. |
|
The keySequence parameter is NULL. |
|
The given text string is empty, or contains an invalid key code. |
|
An unexpected error occurred. |
Remarks
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 sent to the virtual machine session, 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 Key Identifiers Reference topic contains a list of valid key identifier and key modifier strings.
Examples
The following example will send "Hello World!" to the virtual machine session.
BSTR bHello = (BSTR) "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);
Requirements
Product |
Microsoft Virtual Server 2005 onWindows Server 2003 |
Download |
Microsoft Virtual Server 2005 R2 SP1 Update onWindows Server 2008orWindows Server 2003 |
Header |
|