Boa noite, nao entendo de Visual Basic, mas tive que "fazer" um "macro" pra um jogo, e queria melhorar ele um pouco, se alguem puder me ajudar. a primeira coisa que gostaria de fazer é adicionar uma tecla (F5) para ativar o botão 1 e
outra tecla (F6) para ativar o botão 2.
E a outra coisa que gostaria de fazer era aumentar a velocidade dos clicks.. se alguem puder me ajudar ;/
OBS: Esse é o codigo qué estou usando
Imports System.Runtime.InteropServices
Imports System.Threading
Public Class Form1
<DllImport("user32.dll", CallingConvention:=CallingConvention.StdCall, _
CharSet:=CharSet.Unicode, EntryPoint:="keybd_event", _
ExactSpelling:=True, SetLastError:=True)> _
Public Shared Sub KEYB_Event(ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
End Sub
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal Tecla As Keys) As Keys
Declare Sub MOUSE_EVENT Lib "user32" Alias "mouse_event" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
Private Const MOUSEEVENTF_ABSOLUTE = &H8000 ' absolute move
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Private Const MOUSEEVENTF_MOVE = &H1 ' mouse move
Private Const MOUSEEVENTF_MIDDLEDOWN = &H20
Private Const MOUSEEVENTF_MIDDLEUP = &H40
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10
Const VK_CONTROL As Byte = &H11
Const VK_KEY_Q As Byte = &H51
Const VK_KEY_W As Byte = &H57
Const VK_KEY_E As Byte = &H45
Const KEYEVENTF_KEYUP As Byte = &H2
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Const VK_KEY_1 As Byte = &H31
Const VK_KEY_2 As Byte = &H32
Const VK_KEY_3 As Byte = &H33
KEYB_Event(VK_KEY_Q, 0, 0, 0) 'Segura o button 1
KEYB_Event(VK_KEY_Q, 0, 0, 0)
Thread.Sleep(1) ' aqui é o tempo que passa pra outra magia
KEYB_Event(VK_KEY_W, 0, KEYEVENTF_KEYUP, 0) 'Solta o button 1
KEYB_Event(VK_KEY_W, 0, 0, 0) 'Segura o button 2
Thread.Sleep(1) ' aqui é o tempo que passa pra outra magia
KEYB_Event(VK_KEY_E, 0, KEYEVENTF_KEYUP, 0) 'Solta o button 2
KEYB_Event(VK_KEY_E, 0, 0, 0) 'Segura o button 3
Thread.Sleep(1) ' aqui é o tempo que passa pra outra magia
KEYB_Event(VK_KEY_E, 0, KEYEVENTF_KEYUP, 0) 'Solta o button 3
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Start()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Stop()
End Sub
End Class