Ayuda Con Mouse En VB
Publicado por Jorge (4 intervenciones) el 24/01/2007 06:38:50
Bueno necesito una pequeña ayuda, estuve buscando sobre movimientos del mouse en este foro i pude encontrar esto ...
*****
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
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 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Sub MoverMouse(x As Single, y As Single)
Dim pt As POINTAPI
pt.x = x
pt.y = y
SetCursorPos x, y
mouse_event MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
Private Sub Command1_Click()
MoverMouse 30, 10
End Sub
Nota: Yo en lugar de un command le puse un timer asi se hacia automaticamente ...
*****
Pero lo que necesito es que primero haga click en una cordenada establecida ( como puede ser 30 10 ) i luego en dnd se encontraba el mouse inicialmente ...
Es posible hacer eso?, tambien es posible aumentar la velocidad en la que se produce el clikeo ...
Desde ya muchas gracias ...
*****
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function ClientToScreen Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
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 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Sub MoverMouse(x As Single, y As Single)
Dim pt As POINTAPI
pt.x = x
pt.y = y
SetCursorPos x, y
mouse_event MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
End Sub
Private Sub Command1_Click()
MoverMouse 30, 10
End Sub
Nota: Yo en lugar de un command le puse un timer asi se hacia automaticamente ...
*****
Pero lo que necesito es que primero haga click en una cordenada establecida ( como puede ser 30 10 ) i luego en dnd se encontraba el mouse inicialmente ...
Es posible hacer eso?, tambien es posible aumentar la velocidad en la que se produce el clikeo ...
Desde ya muchas gracias ...
Valora esta pregunta


0