Ontosy

_IsPressed(0x13) without {PAUSE}

5 posts in this topic

#1 ·  Posted

why when i use _IsPressed(0x13) it is true also if i not press {PAUSE} key?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You should use the same syntax as in the help file example: _IsPressed("13")

Edited by czardas

Share this post


Link to post
Share on other sites

#3 ·  Posted

I get same result with help file example syntax.

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by czardas
1 person likes this

Share this post


Link to post
Share on other sites

#5 ·  Posted

_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,
 

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