Jump to content

_IsPressed(0x13) without {PAUSE}


Recommended Posts

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
Link to comment
Share on other sites

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

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