Basically I would like to write an app to capture whenever the Num Lock key is pressed. This needs to be supported across windows, linux, mac.
Could the app run in a browser somehow? Using HTML5 and such.
Should the app be written in Qt C++, if so, does Qt library have a cross platform call to interceptNumLock()?
Could it possibly be done on Java?
Through a cross browser add-on?
what are the pros and cons of the above approaches? If so, I can decide after I consider the cons and pros.
You can do it in Java. Windows, Linux and MacOS all support Java. It’s a one liner:
To do the same thing in binary code would require you (A) assume its an x86 machine, and (B) detect the operating system, which would be complex. If you did this, though, you could then make the OS-specific calls to get the capslock state based on which OS it was.
You can potentially do this platform check with Qt using code like this:
Note that you cannot write binary code to get the CAPSLOCK state directly from the BIOS without going through the operating system, which is why any such code is OS-dependent.