Results 1 to 3 of 3

Thread: How do i make the mouse click ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    80
    i know the API movemouse ways , but i want the mouse to click somewhere

    how do i tell the mouse to send a click ?
    Got It , Roger And Out

  2. #2
    Guest
    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&)

  3. #3
    Guest
    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
  •  



Click Here to Expand Forum to Full Width