键盘挂钩多键 [英] Keyboard hook multiple key
本文介绍了键盘挂钩多键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Private Sub kbHook_KeyDown(ByVal Key As System.Windows.Forms.Keys) Handles kbHook.KeyDown
If Keys.Control And Keys.Alt And Keys.Shift And Keys.N Then
Me.Opacity = 100
Me.ShowInTaskbar = True
Me.ShowIcon = True
MsgBox("CTRL + ALT + SPACE") ' This work
Me.BackColor = Color.Indigo
CheckBox3.Checked = False
End If
End Sub
我使用问题我希望键盘在后台时听多个键,但这不起作用.怎么了?
i use question I want the keyboard to listen to multiple keys when it's in the background, but this doesn't work. What's wrong?
推荐答案
这对我有用:
Private Sub kbHook_KeyDown(Key As Keys) Handles kbHook.KeyDown
If My.Computer.Keyboard.CtrlKeyDown AndAlso
My.Computer.Keyboard.AltKeyDown AndAlso
My.Computer.Keyboard.ShiftKeyDown AndAlso
Key = Keys.N Then
Debug.Print("Ctl-Alt-Shift-N")
End If
End Sub
这篇关于键盘挂钩多键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文