2

Is there a reliable cross-platform way to programmatically get and set the NumLock state in Lazarus / Free Pascal?

I've found GetKeyState() in LclIntf which seems to work for getting the state (and is apparently cross-platform), but I can't find an equivalent SetKeyState().

Fat Monk
  • 2,077
  • 1
  • 26
  • 59

1 Answers1

1

Setting leds is rarely part of an userland API, since keyboard leds are hardware, and will require administrator access on most systems.

IIRC I did it once for FreeBSD using the console unit. (which basically sends IOCTLs), Linux is probably similar.

For Windows I found http://support.microsoft.com/kb/177674/en-us, but the fact that it is not an universal call, and differs between win9x and winnt says enough.

Marco van de Voort
  • 25,628
  • 5
  • 56
  • 89