Results 1 to 3 of 3

Thread: mouse click event coding

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 1999
    Location
    Hicksville, NY, US
    Posts
    3

    Post

    I remember seeing some code on vb-world.net a while back on how to make the system right click or left click and also how to make them double click. I searched and i can't find it anymore on the web at all. Can someone link me to somewhere or can someone just make a bas file and send me a copy of it to my email address? i really need this for some program i am working on. Thanks, i need this asap...

    im trying to make a program that will move the mouse around to certain areas of the screen and then click or double click on that spot. So i need the code for the system to right/left to click/double click
    thats what i need...can you help?

    <[email protected]>

  2. #2
    New Member
    Join Date
    Dec 1999
    Posts
    2

    Post

    Bunty, you will need to use API for that. There is too much code for me to list. I will send you soure code for it.

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Try this:
    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 Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
    Private Const MOUSEEVENTF_LEFTDOWN = &H2
    Private Const MOUSEEVENTF_LEFTUP = &H4
    Private Type POINTAPI
        X As Long
        Y As Long
    End Type
    
    Public Sub ClickMouse(X As Long, Y As Long)
        SetCursorPos X, Y
        mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
        mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
    End Sub
    Passing your coordinates will click the left button on the mouse.

    Example: ClickMouse 500, 500

    ------------------

    Serge

    Software Developer
    [email protected]
    ICQ#: 51055819


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