Sign in to follow this  
Followers 0
Tankbuster

[SOLVED] Toggle Numlock/ScrollLock without SEND

4 posts in this topic

#1 ·  Posted (edited)

//edit : Solution is in post #3 follow

Hello,

I tried to use the keyboard lights as an progress indicator (without caps lock of course), but

it turned out in Locked user session (user is locked out because of screensaver for example)

the lights are not flashing anymore.

sample of my Code uses the SEND

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

    global $LastStateNum=0
    global $LastStateScroll=0
    local $msg
    send("{NUMLOCK off}")
    send("{SCROLLLOCK off}")

    GUICreate("dummy",100,100)
    GUISetState()

    Do
        $msg = GUIGetMsg()
        consolewrite($msg)
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
        FlashKeyboard(2)
        sleep(100)

    Until $msg = $GUI_EVENT_CLOSE
        send("{NUMLOCK on}")
    send("{SCROLLLOCK off}")

    exit
func FlashKeyboard($type)
    Select
        case $type = 2
            if $LastStateNum=0 Then
                send("{NUMLOCK on}")
                send("{SCROLLLOCK off}")
                $LastStateNum=1
            Else
                send("{NUMLOCK off}")
                send("{SCROLLLOCK on}")
                $LastStateNum=0
            EndIf
    EndSelect
EndFunc

I wondered if it may work in locked out state with

USER32.DLL and SetKeyboardState.

But I got no idea how to get the USER32.dll call done.

I found that with

DllCall("user32.dll","long","GetKeyState","int",$VK_NUMLOCK)
it is possible to query the state, but what does the setkeyboardstate looks like???

Or is there a better way to flash the lights in locked state? I'm not sure if user32.dll really does work on my issue, I'm just guessing...

Could someone help me out? Or if you already know that the lights won't flash in locked mode, please tell me too.

BTW: I tested this on Win7(x86).

Edited by Tankbuster

Share this post


Link to post
Share on other sites



monoceres did it :>

Yep, this worked (exept with the Logitech limitation, but that does not matter for the target pc)

I tried now to search for the topic and even by knowing the right word the forum search did not return the topic, simply because it is in the example forum. (note for myself next search: Hey, big brain, search always everywhere... :unsure: )

Anyway. This (monoceres) was exactly what I'm searching for.

I didn't take a look to controlsend, simply because I think it will also not work because of the User Lock out limitation. But this is just my guess.

Thank you very much.

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
Sign in to follow this  
Followers 0