Jump to content
Sign in to follow this  
wccppp

How to determine CAPSLOCK state?

Recommended Posts

wccppp

Hello,

Is there a way to determine whether CAPSLOCK in ON or OFF? Thank you.

--

wcc

Share this post


Link to post
Share on other sites
wccppp

Found answer in this forum. Should have searched first. Sorry.

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

#include <Misc.au3>

Global $dll = DllOpen("user32.dll")
Global $num = DllCall("user32.dll", "long", "GetKeyState", "long", 0x90) ; NumPad
Global $rollen = DllCall("user32.dll", "long", "GetKeyState", "long", 0x91) ; Rollen
Global $capslock = DllCall("user32.dll", "long", "GetKeyState", "long", 0x14) ; Capslock
Global $tasten[3] = [$num[0], $rollen[0], $capslock[0]]
Global $string[3] = ["NumPad", "Rollen", "CapsLock"]

For $i = 0 To UBound($tasten) - 1
    If $tasten[$i] = 1 Then
        _FunktionWennAktiv($string[$i])
    Else
        _FunktionWennNICHTAktiv($string[$i])
    EndIf
Next

Func _FunktionWennAktiv($taste)
    MsgBox(64, "A", $taste & " is activ!")
EndFunc   ;==>_FunktionWennAktiv

Func _FunktionWennNICHTAktiv($taste)
    MsgBox(64, "N", $taste & " is not aktiv!")
EndFunc   ;==>_FunktionWennNICHTAktiv

While 1
    Sleep(25)
    If _IsPressed("01", $dll) Then ToolTip("Left Mouse", 0, 0, "MouseClick", 1) 
    If _IsPressed("02", $dll) Then ToolTip("Right Mouse", 0, 0, "MouseClick", 1)
WEnd
DllClose($dll)

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.