vb怎么设置全局热键
发布网友
发布时间:2022-04-28 11:29
我来回答
共1个回答
热心网友
时间:2023-05-21 20:36
我不知道你想要怎样的效果,应该是下面的效果吧
我弄过的,可以的
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Dim key1 As Integer
Const keycode1 As Integer = 121
Private Sub Form_Load()
key1 = GetKeyState(keycode1)
Timer1.Interval = 10
Timer1.Enabled = True
Me.Visible = False
End Sub
Private Sub Timer1_Timer()
If GetKeyState(keycode1) <> key1 Then
MsgBox "你按下了热键"
key1 = GetKeyState(keycode1)
End If
End Sub
你要按F10的,就会看到效果啦