Ver Mensaje Individual
  #8 (permalink)  
Antiguo 12/07/2009, 21:10
Avatar de FTech
FTech
 
Fecha de Ingreso: julio-2009
Mensajes: 88
Antigüedad: 14 años, 10 meses
Puntos: 0
Respuesta: [VB6] Autoclick

Mira te dejo un code que hizo un primo hace poco:

Código vb:
Ver original
  1. Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
  2. 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)
  3. Private Const MOUSELEFTDOWN = &H2 '  left button down /This is actually MOUSEEVENTF_LEFTDOWN
  4. Private Const MOUSELEFTUP = &H4 '  left button up /This is actually MOUSEEVENTF_LEFTUP
  5. Private Const KEY_TOGGLED As Integer = &H1
  6. Private Const KEY_PRESSED As Integer = &H1000
  7.  
  8. Private Sub Form_Load()
  9. Text1.Text = "" 'Para configurar los intervalos de clicks
  10. Timer1.Enabled = False
  11. Timer2.Enabled = True
  12. End Sub
  13.  
  14. Private Sub Timer1_Timer()
  15.     mouse_event MOUSELEFTDOWN, 0, 0, 0, 0 'left button goes down
  16.    mouse_event MOUSELEFTUP, 0, 0, 0, 0 'left button comes up
  17. End Sub
  18.  
  19. Private Sub Timer2_Timer()
  20. If GetKeyState(vbKeyF10) And KEY_PRESSED Then
  21.     MsgBox "Apretaste f10!"
  22.     Timer1.Interval = Val(Text1.Text)'Lee el valor del textbox en MS
  23.    Timer1.Enabled = True
  24. ElseIf GetKeyState(vbKeyF11) And KEY_PRESSED Then
  25.     MsgBox "Apretaste f11!"
  26.     Timer1.Enabled = False
  27. End If
  28. End Sub