Sign in to follow this  
Followers 0
An_icehole

how do sense when left mousebotton is pressed

5 posts in this topic

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

Share this post


Link to post
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 ^^

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Well thanks guys sometimes its hard to see the wood for the trees _IsPressed works perfectly i was looking thru the command list for a mouse based command and missed _IsPressed

once again thanks guys your the best

Share this post


Link to post
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
Sign in to follow this  
Followers 0