Afaq
Afaq

Reputation: 1155

Controlling keyboard LED lights using C

I want to create a program to represent binary numbers using the keyboard's LEDs. How can I control those LED lights using the C language?

Upvotes: 7

Views: 4315

Answers (2)

admiring_shannon
admiring_shannon

Reputation: 934

For Windows:

Because the SetKeyboardState function alters the input state of the calling thread and not the global input state of the system, an application cannot use SetKeyboardState to set the NUM LOCK, CAPS LOCK, or SCROLL LOCK (or the Japanese KANA) indicator lights on the keyboard. These can be set or cleared using SendInput to simulate keystrokes.

See the Windows API ref.

Upvotes: 1

fkl
fkl

Reputation: 5535

For Linux, this would be helpful

setleds

A more comprehensive internals and several command line utilities description

Keyboard and console - HowTo.pdf

Upvotes: 2

Related Questions