I'm writing a program that uses caps-lock as a toggle switch. It would be nice to set the LED of the key to show that my program is on or off, like the capslock key does naturally.
I know that I could just SendInput('Capslock');
or whatever to actually turn caps-lock on and off. But my app is a typing program, and I don't want to have to deal with translating the all-caps keys that turning it on would give me into their lower/upper cases. I might go that route eventually, but not for this version.
I would however be interested in just turning on the LED light WITHOUT actually turning on caps-lock. Is there any way to do that?
Thank you.
I'm pretty sure you can't toggle the LED without toggling the actual Caps lock, unless you were writing a keyboard driver. (I'm not recommending that!)
You can find code for changing indicators on the keyboard from C# at Faking num lock, caps lock and scroll lock leds
There are plugin for Miranda IM named "Keyboard Notify Ext." which contains in its source code C implementation of controlling leds. See file keyboard.c in source. Probably you can port it to C#.
Here are most interesting highlights from source code: