Ontosy Posted April 30, 2017 Posted April 30, 2017 why when i use _IsPressed(0x13) it is true also if i not press {PAUSE} key?
czardas Posted April 30, 2017 Posted April 30, 2017 (edited) You should use the same syntax as in the help file example: _IsPressed("13") Edited April 30, 2017 by czardas operator64 ArrayWorkshop
Ontosy Posted April 30, 2017 Author Posted April 30, 2017 I get same result with help file example syntax.
czardas Posted April 30, 2017 Posted April 30, 2017 (edited) I get a different result to you in every situation. Run the following script first without pressing pause: #include <Misc.au3> MsgBox(0, "_IsPressed(0x13)", _IsPressed(0x13), 2) ; message will time out in 2 seconds Sleep(500) ; slow it down a bit MsgBox(0, "_IsPressed(""13"")", _IsPressed("13"), 2) ; correct syntax You should get False in both cases. Now repeat the experiment while holding down the pause key: after which I get two different results. Edited April 30, 2017 by czardas Ontosy 1 operator64 ArrayWorkshop
Trong Posted April 30, 2017 Posted April 30, 2017 _IsPressed("13") ; correct syntax because Func _IsPressed($sHexKey, $vDLL = 'user32.dll') ; $hexKey must be the value of one of the keys. ; _Is_Key_Pressed will return 0 if the key is not pressed, 1 if it is. Local $a_R = DllCall($vDLL, "short", "GetAsyncKeyState", "int", '0x' & $sHexKey) If @error Then Return SetError(@error, @extended, False) Return BitAND($a_R[0], 0x8000) <> 0 EndFunc ;==>_IsPressed Regards,
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now