Results 1 to 2 of 2

Thread: mouse clicking

  1. #1

    Thread Starter
    Member bcx7's Avatar
    Join Date
    May 1999
    Location
    Adelaide, South Australia, Australia
    Posts
    46
    how can i get the mouse to click on the position that it is on the screen but for the user not to acually click (my program clicks the mouse for the user).

    is this possible and how do i do it?

    (i'm sorry if it doesn't make sense)


    thanks
    I Use Visual Basic 5.0 Enterprise Edition SP3

  2. #2
    Guest
    I believe this code will work.
    It makes the mouse button click without having the user do it.
    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&)
    And to move the mouse pointer to where you want to click:

    Code:
    Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
    
    Dim t&
    t& = SetCursorPos(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