Search code examples
macosqtmacos-carbon

Generate the hardware interupt which will enable the CapsLock


I want to Send my machine an hardware event so that my caps-lock key becomes enable. When I send enable interrupt, light on Caps-lock key should be on and when I send enable interrupt, light on Caps-lock key should be off.

I am using Qt, Mac, C++, Carbon.


Solution

  • No need for an interrupt. The Caps Lock, Num Lock, and Scroll Lock lights are programmatically controllable.

    Note that this won't actually turn the Caps Lock on (causing the user to enter all-capital text), but you shouldn't do that. If you need text input to be in a specific format, then you should make any needed repairs to it—which may include capitalizing it—yourself.