怎样用汇编指令实现左右shift同时按下才跳转啊(最好能帮忙写下代码)谢谢

 我来答
flycat0511
2011-06-27 · TA获得超过1402个赞
知道小有建树答主
回答量:363
采纳率:100%
帮助的人:386万
展开全部
如何识别键盘左右的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

参考资料: http://www.pcppc.cn/jichu/diannaojiqiao/jichu_25647_2.html

推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式