Results 1 to 3 of 3

Thread: mouse_event

  1. #1

    Thread Starter
    Lively Member stever2003's Avatar
    Join Date
    Dec 2000
    Posts
    109

    Question

    How do I use the mouse_event API? I can get the declaration and the constants. I need to simulate the click of a mouse so that it would be like the user clicking the mouse. I just need an example of the usage of the API call. Thanks.

  2. #2
    Guest
    This will click the left button.
    Code:
    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 Sub Command1_Click()
        mouse_event 6, 0, 0, 0, 0
    End Sub

  3. #3
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    You could do that, but it is bad practice to actually move the user's mouse around screen to click buttons, which the mouse_event does. Instead, get the handle to the object you want to send a click to, and tell it you clicked it with sendmessage.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

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