I would like to maintain num-lock ON as long as my application is running, so that if the user un-toggles num-lock, it will immediately be toggled back on. What's the simplest way to achieve that in C#?
To clarify, while my application is running I "own" the user's machine, so in my specific case there will not be a need for the user to un-toggle num-lock (that does not mean I have focus at all times).
Thanks
You need to add a low level keyboard hook to do this. Stephen Toub wrote a tutorial on his blog on setting this up.
Your keyboard hook can check the status of VK_NUMLOCK. For a VB example see here.