Ver Mensaje Individual
  #8 (permalink)  
Antiguo 18/06/2010, 08:06
Avatar de JuJoGuAl
JuJoGuAl
 
Fecha de Ingreso: julio-2009
Ubicación: Venezuela
Mensajes: 754
Antigüedad: 14 años, 9 meses
Puntos: 19
Respuesta: Ejecutar en segundo plano Vb6

Bueno amigo partiendo de tucodigo y algo que encontre en google este seria el Programa final:

Código vb:
Ver original
  1. Option Explicit
  2. Private Const constKeyDown = -32767
  3. Private Type POINTAPI
  4. X As Long
  5. Y As Long
  6. End Type
  7.  
  8. 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)
  9. Private Const MOUSEEVENTF_LEFTDOWN = &H2
  10. Private Const MOUSEEVENTF_LEFTUP = &H4
  11. Private Const MOUSEEVENTF_MIDDLEDOWN = &H20
  12. Private Const MOUSEEVENTF_MIDDLEUP = &H40
  13. Private Const MOUSEEVENTF_MOVE = &H1
  14. Private Const MOUSEEVENTF_RIGHTDOWN = &H8
  15. Private Const MOUSEEVENTF_RIGHTUP = &H10
  16.  
  17. Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
  18. Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
  19. Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
  20.      
  21. Private Sub Form_Load()
  22. Timer1.Interval = 50
  23. Timer1.Enabled = True
  24. 'Me.Hide
  25. End Sub
  26.  
  27. Private Sub Timer1_Timer()
  28. Dim Point As POINTAPI
  29.          
  30. If GetAsyncKeyState(40) <= constKeyDown Then
  31. 'MsgBox ("Abajo")
  32. GetCursorPos Point
  33. SetCursorPos Point.X, Point.Y + 10
  34. End If
  35.        
  36. If GetAsyncKeyState(38) <= constKeyDown Then
  37. 'MsgBox ("Arriba")
  38. GetCursorPos Point
  39. SetCursorPos Point.X, Point.Y - 10
  40. End If
  41. If GetAsyncKeyState(37) <= constKeyDown Then
  42. 'MsgBox ("Izquierda")
  43. GetCursorPos Point
  44. SetCursorPos Point.X - 10, Point.Y
  45. End If
  46. If GetAsyncKeyState(39) <= constKeyDown Then
  47. 'MsgBox ("Derecha")
  48. GetCursorPos Point
  49. SetCursorPos Point.X + 10, Point.Y
  50. End If
  51. If GetAsyncKeyState(13) <= constKeyDown Then
  52. 'MsgBox ("Enter")
  53. mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
  54. mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
  55. End If
  56. If GetAsyncKeyState(32) <= constKeyDown Then
  57. 'MsgBox ("Espacio")
  58. mouse_event MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0
  59. mouse_event MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0
  60. End If
  61. End Sub
Lo unico que faltaria es hacerle Hide al Form para que quedara oculto...

o no se si habra una forma de que se coloque en la barra de tareas (como la Hora o los iconos del Antivirus..)

pero ya basicamente hace lo que buscaba..

Ah yo use ENTER y ESPACIO como CLIC y RightClic