|
-
Sep 9th, 2000, 05:10 PM
#1
Thread Starter
Lively Member
i know the API movemouse ways , but i want the mouse to click somewhere
how do i tell the mouse to send a click ?
-
Sep 9th, 2000, 05:38 PM
#2
Use the mouse_event api function.
Code:
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 Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Call mouse_event(MOUSEEVENTF_LEFTDOWN, 0&, 0&, 0&, 0&)
Call mouse_event(MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&)
-
Sep 9th, 2000, 05:47 PM
#3
Use PostMessage
Code:
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Private Const MK_LBUTTON = &H1
Private Sub Command1_Click()
'click the Form
PostMessage Me.hwnd, WM_LBUTTONDOWN, MK_LBUTTON, 0
PostMessage Me.hwnd, WM_LBUTTONUP, MK_LBUTTON, 0
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|