Jump to content
Ontosy

_IsPressed(0x13) without {PAUSE}

Recommended Posts

Ontosy

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
czardas

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
Ontosy

I get same result with help file example syntax.

Share this post


Link to post
Share on other sites
czardas

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
  • Like 1

Share this post


Link to post
Share on other sites
VIP
_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

×