VB中知道了键盘各个按键的代码,怎样编写,举个例子吧!谁来开头!要控件的顺便说下
展开全部
1.检测是否按了“↑”键,例
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyUp Then msgbox "您按了↑键!"
End Sub
2.检测按组合键
If (KeyCode = vbKeyNumpad0) And (Shift = 2) Then '按Ctrl+小键盘0
If (KeyCode = vbKeyF1) And (Shift = 2) Then '按Ctrl+F1
3.模拟按组合键
SendKeys "%{f4}" 'Alt+F4(关闭窗口)
SendKeys "{y 5}" '连续按5个y
SendKeys "Welcome" '发送字串
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyUp Then msgbox "您按了↑键!"
End Sub
2.检测按组合键
If (KeyCode = vbKeyNumpad0) And (Shift = 2) Then '按Ctrl+小键盘0
If (KeyCode = vbKeyF1) And (Shift = 2) Then '按Ctrl+F1
3.模拟按组合键
SendKeys "%{f4}" 'Alt+F4(关闭窗口)
SendKeys "{y 5}" '连续按5个y
SendKeys "Welcome" '发送字串
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2011-08-31
展开全部
set( $config-
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询