'定义了一个F1触发Command1_Click,系统级的热键,自己修改一下
Option Explicit
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Sub Command1_Click()
Debug.Print Timer
End Sub
Private Sub Form_Load()
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyF1) Then
Do Until (GetAsyncKeyState(vbKeyF1) >= 0) '防止长按键
DoEvents
Loop
Command1_Click
End If
End Sub
系统热键。百度VB注册系统热键。