Jump to content

how do sense when left mousebotton is pressed


Recommended Posts

i want to get the x and y cords when i click the left mouse button, i want to use MouseGetPos but only after the left mouse button has been clicked is this possible as i cannot seem to find a command that detects when the mouse button is pressed can anyone help please

Link to comment
Share on other sites

i want to get the x and y cords when i click the left mouse button, i want to use MouseGetPos but only after the left mouse button has been clicked is this possible as i cannot seem to find a command that detects when the mouse button is pressed can anyone help please

read about _IsPressed in the helpfiles, I'm pretty sure it will help you ^^

Link to comment
Share on other sites

Dim $pos

While 1
    If _IsPressed(0x01) Then
        $pos = MouseGetPos()
        ;do whatever with $pos[0] and $pos[1] (x and y respectively) here
    EndIf
    Sleep(25)
WEnd

Func _IsPressed($hexKey)
    Local $ret = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
    If Not @error And BitAND($ret[0], 0x8000) = 0x8000 Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...