Num Lock Lockdown
Keeps Num Lock permanently ON, with a modifier key for temporary override
Author: tonythethompson
Keeps Num Lock ON with almost no background work. A low-level keyboard hook
watches the Num Lock key and the override modifier. There is no fast polling.
An optional slow safety check (off, or every few seconds; 10 s by default)
covers the few cases the hook cannot see.
Behavior
| Situation |
Result |
| Normal use |
Num Lock stays ON. The Num Lock key does nothing (default). |
| Hold Shift + press Num Lock |
Normal toggle is allowed. |
| Release Shift |
Num Lock is forced back ON if it is off. |
| Sleep/wake, RDP, or another program turns it off |
Forced back ON on the next event, on unlock/resume/focus change, or on the safety check. |
| Mod disabled |
The Num Lock key behaves normally again. The LED is left ON (the last forced state), not restored to whatever it was before the mod ran. |
Hold Left Shift or Right Shift and press Num Lock to toggle it
normally for as long as you keep Shift down. While Shift is held, numpad
arrows are Shift+Arrow in most apps (extend selection), not plain arrows.
Ctrl, Alt, and Win have the same kind of extra meaning. Release the
override and Num Lock is turned back on.
Block (the default) swallows Num Lock for every process, so a game or app
that uses Num Lock as a hotkey will not see the key. Use Allow if you need
those binds; the mod still forces Num Lock back ON on key-up.
Why a tool mod?
The mod is loaded into a dedicated windhawk.exe process (@include windhawk.exe). It does not inject into Explorer or every running app. That
keeps overhead low and avoids tying Num Lock to the shell process.
Notes
- The keyboard hook cannot see keystrokes sent to a higher-integrity
(elevated) window because of UIPI.
SendInput is also subject to UIPI:
when an elevated window is focused, the injected Num Lock pulse is
dropped and neither the return value nor GetLastError reports it. Run
Windhawk as administrator if you need the force-on to work while an
elevated app is in front. When focus moves back to a normal window, a
foreground-change hook retries the pulse. The safety check is a slower
fallback for cases with no focus change.
- The hook also cannot see some Remote Desktop / KVM paths. Session-unlock
/ resume handlers and the safety check cover those.
- If the hook misses a modifier key-up (elevated window or secure desktop),
the next Num Lock event re-reads the real modifier state from the OS, and
the worker does the same before skipping a force-on.
- Block also swallows the ToggleKeys accessibility shortcut (hold Num
Lock for 5 seconds) and the MouseKeys shortcut (Left Alt + Left Shift +
Num Lock) whenever your override modifier is not Shift or Alt. Use
Allow if you need those shortcuts.
- Synthetic Num Lock presses this mod sends are tagged and ignored by
this hook, so the force-on path cannot fight itself. Other apps still
see those injected presses (the pulse has to reach the OS to move the
LED). A game bound to Num Lock can therefore see a synthetic press when
a force-on fires, even in Block mode.
- In "allow" mode, holding Num Lock without the modifier can leave it off
until you release the key. Auto-repeat is swallowed so the LED does not
flicker; force-on runs on key-up. If the safety check is on (10 s by
default), it can still force Num Lock back ON while the key is held.
- The Win key is never blocked. Only Num Lock is filtered. If you hold Win and
press numpad 1/3/5/9, Windows may type those digits because Win+Numpad1 is
not the same shortcut as Win+1 on the number row. That is OS behavior.