Как из программы управлять мышкой?! ...
как перемещать указатель я нашел, win32.SetCursorPos() ... а вот нажатие кнопок никак, если кто знает подскажите плз!!!
Private Const MOUSEEVENTF_ABSOLUTE = &H8000
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 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)
Public Enum enButtonToClick
btcLeft
btcRight
btcMiddle
End Enum
Public Sub MouseClick(ByVal MBClick As enButtonToClick)
Dim cbuttons As Long, dwExtraInfo As Long, mevent As Long
Select Case MBClick
Case btcLeft
mevent = MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP
Case btcRight
mevent = MOUSEEVENTF_RIGHTDOWN Or MOUSEEVENTF_RIGHTUP
Case btcMiddle
mevent = MOUSEEVENTF_MIDDLEDOWN Or MOUSEEVENTF_MIDDLEUP
Exit Sub
End Select
Call mouse_event(mevent, 0&, 0&, cbuttons, dwExtraInfo)
End Sub
Public Sub MouseMove(ByRef X As Long, ByRef Y As Long)
Dim cbuttons As Long, dwExtraInfo As Long
Call mouse_event(MOUSEEVENTF_ABSOLUTE Or MOUSEEVENTF_MOVE, X, Y, cbuttons, dwExtraInfo)
End Sub
Private Sub Form_Load()
MouseMove 0, 0
MouseClick btcLeft
End Sub
Сейчас этот форум просматривают: Yandex-бот и гости: 69