怎样用汇编指令实现左右shift同时按下才跳转啊(最好能帮忙写下代码)谢谢
1个回答
展开全部
如何识别键盘左右的shift,Ctrl或Alt键。> vb ie 相关内容:vb ie
用API (GetAsyncKeyState)实现,在WIN 2K,XP 下有效:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Const VK_LSHIFT = &HA0
Private Const VK_RSHIFT = &HA1
Private Const VK_LCTRL = &HA2
Private Const VK_RCTRL = &HA3
Private Const VK_LMENU = &HA4
Private Const VK_RMENU = &HA5
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyShift And Shift = vbShiftMask And (GetAsyncKeyState(VK_LSHIFT) And &H8000)
Then MsgBox "you click the Left Shift"
If KeyCode = vbKeyShift And Shift = vbShiftMask And (GetAsyncKeyState(VK_RSHIFT) And &H8000)
Then MsgBox "you click the RIGHT Shift"
If KeyCode = vbKeyMenu And Shift = vbAltMask And (GetAsyncKeyState(VK_LMENU) And &H8000)
Then MsgBox "you click the Left ALT" ' only ALT was pressed
If KeyCode = vbKeyMenu And Shift = vbAltMask And (GetAsyncKeyState(VK_RMENU) And &H8000)
Then MsgBox "you click the RIGHT ALT" ' only ALT was pressed
If KeyCode = vbKeyControl And Shift = vbCtrlMask And (GetAsyncKeyState(VK_LCTRL) And &H8000)
Then MsgBox "you click the Left CTRL"
If KeyCode = vbKeyControl And Shift = vbCtrlMask And (GetAsyncKeyState(VK_RCTRL) And &H8000)
Then MsgBox "you click the Right CTRL"
End Sub
Private Sub Form_Load()
Me.KeyPreview = True
End Sub
用API (GetAsyncKeyState)实现,在WIN 2K,XP 下有效:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Const VK_LSHIFT = &HA0
Private Const VK_RSHIFT = &HA1
Private Const VK_LCTRL = &HA2
Private Const VK_RCTRL = &HA3
Private Const VK_LMENU = &HA4
Private Const VK_RMENU = &HA5
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyShift And Shift = vbShiftMask And (GetAsyncKeyState(VK_LSHIFT) And &H8000)
Then MsgBox "you click the Left Shift"
If KeyCode = vbKeyShift And Shift = vbShiftMask And (GetAsyncKeyState(VK_RSHIFT) And &H8000)
Then MsgBox "you click the RIGHT Shift"
If KeyCode = vbKeyMenu And Shift = vbAltMask And (GetAsyncKeyState(VK_LMENU) And &H8000)
Then MsgBox "you click the Left ALT" ' only ALT was pressed
If KeyCode = vbKeyMenu And Shift = vbAltMask And (GetAsyncKeyState(VK_RMENU) And &H8000)
Then MsgBox "you click the RIGHT ALT" ' only ALT was pressed
If KeyCode = vbKeyControl And Shift = vbCtrlMask And (GetAsyncKeyState(VK_LCTRL) And &H8000)
Then MsgBox "you click the Left CTRL"
If KeyCode = vbKeyControl And Shift = vbCtrlMask And (GetAsyncKeyState(VK_RCTRL) And &H8000)
Then MsgBox "you click the Right CTRL"
End Sub
Private Sub Form_Load()
Me.KeyPreview = True
End Sub
参考资料: http://www.pcppc.cn/jichu/diannaojiqiao/jichu_25647_2.html
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询