Código
Private Declare Function Getasynckeystate Lib "user32" Alias "GetAsyncKeyState" (ByVal VKEY As Long) As Integer Const WM_NCLBUTTONDOWN = &HA1 Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long) Private Const MOUSEEVENTF_LEFTDOWN = &H2 Private Const MOUSEEVENTF_LEFTUP = &H4 Private Const MOUSEEVENTF_MIDDLEDOWN = &H20 Private Const MOUSEEVENTF_MIDDLEUP = &H40 Private Const MOUSEEVENTF_MOVE = &H1 Private Const MOUSEEVENTF_RIGHTDOWN = &H8 Private Const MOUSEEVENTF_RIGHTUP = &H10 Private Sub Text1_change() If Not IsNumeric(Text1.Text) Then MsgBox "solo numeros", vbCritical, "error" End Sub Private Sub Timer1_Timer() Call mouse_event(MOUSEEVENTF_LEFTDOWN, 100, 100, 0, 0) Call mouse_event(MOUSEEVENTF_LEFTUP, 100, 100, 0, 0) End Sub Private Sub Timer2_Timer() On Error Resume Next Dim keystate As Long Dim keystate2 As Long keystate = Getasynckeystate(vbKeyF6) keystate2 = Getasynckeystate(vbKeyF7) If (keystate And &H1) = &H1 Then Timer1.Interval = Text1.Text Exit Sub End If If (keystate2 And &H1) = &H1 Then Timer1.Interval = 0 Exit Sub End If End Sub
Como solo pulsando no hacia la accion, tenia que pulsar y soltar asi que lo agregue en el timer, luego en el mismo programa puedo especificar cada cuanto tiempo quiero hacer el bucle de clicks
por cierto, como se haria para que en vez de estar minimizado pasase a la barra de tareas que es mas comodo?
gracias