Jump to content

Detecting when a key was released (not pressed!)


Recommended Posts

Hi all, I am making a simple script that detects, whether the shift key is held down and for how long... When I try _IsPressed I cannot differentiate between the shift key being held down or if it has just been released.

Is there any way to do this? Thanks for your support!

Link to comment
Share on other sites

Func GetKeyState($VK_Code)
    Local $a_Return = DllCall("user32.dll","short","GetKeyState","int",$VK_Code)
    If $a_Return[0] < -126 Then 
        Return 1    ;Key is pressed
    Else
        Return 0    ;Key is released
    EndIf
EndFunc

www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

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...