用VB做个简单的虚拟按键

来源:百度知道 编辑:UC知道 时间:2024/05/22 12:39:30
每100毫秒按一次F2 F11开始 F12结束 能用的追加分 我是准备在游戏里实验这个东西 有点笨 总是做不好 求助啊

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

Me.Caption = KeyCode

If KeyCode = 122 Then
Timer1.Interval = 100
Timer1.Enabled = True
End If

If KeyCode = 123 Then
Timer1.Enabled = False
End If

End Sub

Private Sub Timer1_Timer()
SendKeys "{F2}"
End Sub

Dim i As Integer

Private Sub Form_Load()
i = 2
Timer1.Interval = 100
End Sub

Private Sub Timer1_Timer()
keytmp = "{F" + CStr(i) + "}"
Form1.Caption = keytmp
i = i + 1
If i > 12 Then
i = 2
End If
End Sub

这个的需要挂到那个程序上的吧?结果消息告诉我呀。