代码如下:
Private Declare Function GetAsyncKeyState Lib "User32" (ByVal Vkey As Long) As Integer
Private Function MyHotKey(vKeyCode) As Boolean
MyHotKey = GetAsyncKeyState(vKeyCode) < 0
End Function
Private Sub Form_Load()
Timer1.Interval = 50
Label1.Caption = "热键是 F1"
End Sub
Private Sub Timer1_Timer()
If MyHotKey(vbKeyF1) Then
MsgBox "你按下了热键!", , "热键提示"
End If
End Sub
控件:标签1个,时钟控件1个.