Public Class Keyboard
Dim instance As Keyboard
public class Keyboard
public ref class Keyboard
有关详细信息,请参见 Visual Basic 主题 My.Computer.Keyboard 对象。
My.Computer.Keyboard 对象提供与计算机键盘的接口。My.Computer.Keyboard 的属性提供有关几个特殊键的状态的信息。使用 My.Computer.Keyboard.SendKeys 方法可以向活动窗口发送键,就像在键盘键入一样。
此示例使用 My.Computer.Keyboard.CtrlKeyDown 属性确定是否按下了计算机的 Ctrl 键。
If My.Computer.Keyboard.CtrlKeyDown Then MsgBox("CTRL key down") Else MsgBox("CTRL key up") End If
Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。