谁能给个VB代码

来源:百度知道 编辑:UC知道 时间:2024/06/22 12:32:35
谁能给个VB代码 是要在任何窗口能可以用的。
按下F7开始F8停止
每1秒按一下A键
是要在什么窗口都能用的。

v

不能保证所有窗口都能用
有些游戏已经屏蔽了~~
自己测试~~
不能使用再告诉我~

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal Scan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Private Sub Timer2_Timer()

If GetAsyncKeyState(vbKeyF7) Then '按下F7执行
Timer1.Enabled = True
End If
If GetAsyncKeyState(vbKeyF8) Then '按下F8停止
Timer1.Enabled = False
End If

End Sub

Private Sub Form_Load()
Timer1.Interval = 1000 '1000大约为一秒,最大60000(1分钟),最小1
Timer2.Interval = 10 '此处最好不要修改,是检测你是否按下快捷键
Timer1.Enabled = False
Timer2.Enabled = True
End Sub

Private Sub Timer1_Timer()
Call keybd_event(65, 0, 0, 0) '按下A
End Sub

朋友是要搞个游戏自动操作器吧!