Results 1 to 5 of 5

Thread: Send A Left Mouse Click??

  1. #1

    Thread Starter
    Hyperactive Member rockies1's Avatar
    Join Date
    Jul 1999
    Location
    Stuck at work
    Posts
    375

    Question

    I've looked and looked to no avail...

    How do I send a left mouse click via code?
    Morgan
    [email protected] - Home
    [email protected] - Work
    Using VB6 SP6 but trying to learn VB2005EE

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    not sure

    not sure what you mean by SEND
    if you wanna capture it
    in mousedown of a contro/form
    Code:
    if Button = 1 then
       msgbox "you have clicked left button"
    end if
    sorry if that didn't help

  3. #3

    Thread Starter
    Hyperactive Member rockies1's Avatar
    Join Date
    Jul 1999
    Location
    Stuck at work
    Posts
    375

    Unhappy

    No, not capture it..I want to essentially click the left mouse button, but using code...Not the mouse itself...
    Morgan
    [email protected] - Home
    [email protected] - Work
    Using VB6 SP6 but trying to learn VB2005EE

  4. #4
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    Red face

    hmmm
    you gotz to use apis for dis one
    i think if you elaborate more on what your using this click for, i or someone else could help you come up with an alternative of doing it

    sorry about first post, since i totally didn't get the question

  5. #5
    Guest
    Here is how to send a mouse click using 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&)

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