Visual Basic - mover y hacer click del mouse por codigo

Life is soft - evento anual de software empresarial
 
Vista:

mover y hacer click del mouse por codigo

Publicado por christian (5 intervenciones) el 26/09/2003 18:11:55
que api utilizo para mover el mouse y hacer click con el boton izquierdo???

gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:mover y hacer click del mouse por codigo

Publicado por J.Fernando (47 intervenciones) el 26/09/2003 18:56:07
Esto puede ayudarte

Option Explicit
Const MOUSEEVENTF_MOVE = &H1 ' movimiento del mouse
Const MOUSEEVENTF_LEFTDOWN = &H2 ' botón izquierdo presionado
Const MOUSEEVENTF_LEFTUP = &H4 ' botón izquierdo soltado
Const MOUSEEVENTF_RIGHTDOWN = &H8 ' botón derecho presionado
Const MOUSEEVENTF_RIGHTUP = &H10 ' botón derecho soltado
Const MOUSEEVENTF_MIDDLEDOWN = &H20 ' botón central presionado
Const MOUSEEVENTF_MIDDLEUP = &H40 ' botón central soltado
Const MOUSEEVENTF_ABSOLUTE = &H8000 ' movimiento absoluto
Dim Res 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)

Function Simular_Pulsacion(x As Long, y As Long)


Res = SetCursorPos(x, y)
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_LEFTDOWN, x, y, 0, 0
mouse_event MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_LEFTUP, x, y, 0, 0
End Function

Private Sub Command1_Click()
Res = Simular_Pulsacion(Form1.Width, Form1.Height)
End Sub

Con Gusto

Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar