Jump to content

Read Status of Num/Caps/Scroll Lock -


Recommended Posts

Hello,

here http://www.autoitscript.com/forum/index.ph...amp;#entry82994 GaryFrost gave us code how to read the status of NUM/CAPS/SCROLL. Is it included in the current autoit3 version? Then I miss it.

If not, it might be nice to add it as a standard builtin function?

Regards, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

Dim $ret, $a_keystate[4]
While 1
$KeyStates = _GetKeyState()
For $i = 1 to $KeyStates[0]
    ConsoleWrite($KeyStates[$i] & @LF)
Next
WEnd

Func _GetKeyState()
    Const $VK_NUMLOCK = 0x42
    Const $VK_SCROLL = 0x43
    Const $VK_CAPITAL = 0x41
    $a_keystate[0] = 3
    $ret = DllCall("user32.dll", "long", "GetKeyState", "long", $VK_NUMLOCK)
    $a_keystate[1] = $ret[0]
    
    $ret = DllCall("user32.dll", "long", "GetKeyState", "long", $VK_SCROLL)
    $a_keystate[2] = $ret[0]

    $ret = DllCall("user32.dll", "long", "GetKeyState", "long", $VK_CAPITAL)
    $a_keystate[3] = $ret[0]

    Return $a_keystate
EndFunc ;==>_GetKeyState

This works for me.

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