13

So this question is not about having num lock on by default.

Is it possible to have num lock turned on, and remove the ability of the num lock button on the keyboard to affect that state?

EDIT (because):

In my keyboard the Home button is really close to the numlock. At work I often use Home and the numpad, but sometimes I accidentally hit the numlock too. As a result my numpad gets turned off which is really sucks when I have to type a lot of numbers and after a while I realise I typed nothing because numlock turned off numpad.

5
+100

I use CapShift and it's free:

https://www.donationcoder.com/Software/Skrommel/index.html#CAPshift

"CAPshift extends the Caps Lock key by slowing it down...

  • Hold down for 0.5 sec to enable/disable.
  • Hold down for 1 sec to show the menu.
  • Rightclick the tray icon to show the menu.
  • Also slows down F1, Insert, NumLock and ScrollLock."

The Advantage is: You don't lose the ability to change NumLock if you really need to.

  • Sounds good but the installer does not run on Windows 8.1 :[ – Adam Varhegyi Jan 19 '16 at 15:23
4

Physically remove the NumLock key. When your finger goes to press it, it won't be there.

  • The foolproof solution. – Rohit Gupta Jan 20 '16 at 0:32
  • 4
    It is actually not foolproof. Some software (HyperV for example) can toggle numlock off again, and when you have removed the key from the keyboard (or used SharpKeys) you have to fool around and reboot to get it back on. – StingyJack Oct 25 '17 at 14:22
3

It's possible to automatically put it back on (within a few milliseconds) when it gets turned off, via an application.

This guy created an autohotkey script for it which he calls "Numlock Enforcer" http://www.donationcoder.com/forum/index.php?topic=9018.0

Not to most elegant solution, but it should work.

1

Maybe not the answer you are looking for, but it solved that problem for me:

Activate the sound for the Lock keys in Windows (in Windows 10: Control Panel\Ease of Access\Ease of Access Center\Make the keyboard easier to use\Turn on Toggle keys)

That way, when you hit it, it beeps, and you realize it right away. It actually trained me to not hit it anymore at all, because the signal is right when it happens.

  • Nice idea, working with built-in functionality! – Oliver Jan 19 '16 at 13:20
1

If you use Autohotkey, you can add the following line to your script:

SetNumLockState, AlwaysOn

Be sure to put this line before your hotkeys. I put it at the very beginning of my script so I make sure it always works fine, if you put it in the middle or at the end of your script, it may not work.

0

The BIOS might have a setting to disable the NumLock key, but we need to know your computer-model and BIOS-version to discuss this more in depth. Typically, one boots into the BIOS and looks for an item named "NumLock State", "Bootup NumLock State" or similar, press Enter and use the arrow keys to select "Off" or "Disabled", then press Enter.

For Windows hackers, the registry contains in HKCU\Control Panel\Keyboard an item named InitialKeyboardIndicators which has the undocumented value of 1 to disable the NumLock. Its effectiveness may vary according to the version of Windows.

The brutal solution is to pop off the Numlock key cap and use a pen to change its setting when required. The setting will normally stick, since Windows XP and later remember its state across boots (unless the BIOS or other setting interferes).

0

Step 1

Change the registry to set initial state of NumLock to on at startup:

HKEY_USERS\.DEFAULT\Control Panel\Keyboard\InitialKeyboardIndicators
  Set to Value to 2

Step 2

Add an AutoHotkey script to monitor the key and ensure it cannot be turned off. Install AutoHotkey, and create a new script named MyBestNumlockHack.ahk. Put this script in your C:\Users\{User Name}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup directory.

Numlock::
  if (!GetKeyState("NumLock", "T"))
    SetNumLockState, On
  return
0

Make a timer and call it NumlOn. Set the interval on 100.

Public Const VK_NUMLOCK = &H90
Declare Function GetKeyState Lib "user32" Alias "GetKeyState" _
(ByVal ByValnVirtKey As Integer) As Short
Dim NLKey as boolean

Private Sub me_keyDown(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    If e.KeyCode = Keys.NumLock And Not NLKey Then
        If Not GetKeyState(VK_NUMLOCK) Then
            e.Handled = True
            NumlOn.Start()
            Exit Sub
        End If
    End If
End sub

Private Sub NumlOn_Tick(sender As Object, e As EventArgs) _ 
Handles NumlOn.Tick
    NLKey = True
    If Not GetKeyState(VK_NUMLOCK) Then numlockON()
    Application.DoEvents()
    NumlOn.Stop()
    NLKey = False
 End Sub
  • 2
    Where’s the beef? I suppose you want the use to put this code into a file. What then?  How do you use it?  How does it work? Please do not respond in comments; edit your answer to make it clearer and more complete. – Scott Mar 23 '18 at 2:18
0

Forgot a sub... This is fully working

Public Const VK_NUMLOCK = &H90
Declare Function GetKeyState Lib "user32" Alias "GetKeyState" _
(ByVal ByValnVirtKey As Integer) As Short

Private Sub numlockON()
    keybd_event(VK_NUMLOCK, 0, 0, 0) ' Press NUMLOCK key down
    keybd_event(VK_NUMLOCK, 0, KEYEVENTF_KEYUP, 0)
End Sub

Private Sub me_keyDown(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    If e.KeyCode = Keys.NumLock And Not NLKey Then
        If Not GetKeyState(VK_NUMLOCK) Then
            e.Handled = True
            NumlOn.Start()
            Exit Sub
        End If
    End If
End sub

Private Sub NumlOn_Tick(sender As Object, e As EventArgs) Handles NumlOn.Tick
    NLKey = True
    If Not GetKeyState(VK_NUMLOCK) Then numlockON()
    Application.DoEvents()
    NumlOn.Stop()
    NLKey = False
End Sub
  • 1
    Welcome to Super User. Rather than posting multiple answers, please just correct the previous answer and delete this one, or delete that one if it needs the changes in this one. Also, what Scott said on your other answer. – fixer1234 Mar 23 '18 at 2:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.