Jump to content

How to determine CAPSLOCK state?


wccppp
 Share

Recommended Posts

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

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