IVMKeyboard interface

[Windows Virtual PC is no longer available for use as of Windows 8. Instead, use the Hyper-V WMI provider (V2).]

Controls the keyboard device within a virtual machine. The IVMKeyboard for a virtual machine can be retrieved using the IVMVirtualMachine::Keyboard property.

Members

The IVMKeyboard interface inherits from the IDispatch interface. IVMKeyboard also has these types of members:

Methods

The IVMKeyboard interface has these methods.

Method Description
IsPressed Determines whether the specified key is down.
PressAndReleaseKey Simulates a key being pressed down and then released.
PressKey Simulates a key being pressed down.
ReleaseKey Simulates a key being released.
TypeAsciiText Simulates a series of ASCII keys being typed into the guest.
TypeKeySequence Simulates a comma-delimited list of keys being typed in the guest.

Properties

The IVMKeyboard interface has these properties.

Property Access type Description
HasExclusiveAccess
Read/write
Indicates whether this object has exclusive control over the virtual machine's keyboard device.

Remarks

Keys can be typed into the virtual machine in several ways. To type a normal ASCII sequence of characters, use the TypeAsciiText method. If greater flexibility is required, IVMKeyboard has several methods that are designed to be used with the key codes in the following list. The TypeKeySequence method can accept a comma-delimited string of key codes, which will be pressed and released, in order, within the virtual machine. In addition to these key codes, the keywords UP and DOWN can be used to force a key to only be pressed, or only be released. The UP and DOWN keywords only apply to the key code directly following the keyword.

To avoid multiple scripts, applications, or users from simultaneously attempting to access the same keyboard device, set the HasExclusiveAccess property to TRUE. If exclusive access is acquired by one process, any attempts by other processes to send input to the keyboard device will be ignored until exclusive access has been released.

Requirements

Requirement Value
Minimum supported client
Windows 7 [desktop apps only]
Minimum supported server
None supported
End of client support
Windows 7
Product
Windows Virtual PC
Header
VPCCOMInterfaces.h
IID
IID_IVMKeyboard is defined as 00695f2e-c5ad-4d6e-b1ab-336ed121f8c4

See also

Windows Virtual PC Interfaces

Key Sequences