LKBEN10612: A windows C application for activating the NUMLOCK key


Numlock does not work via registry change and InitialKeyboardIndicators set to 2


The registry is not alway a solution to your problems. ;-)


I wrote a simple application in C which checks and sets the NUMLOCK key.

You can put it in a compiler and compile it.

// NUMLOCK-on.cpp : Programmed by Wim Peeters.

#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
    SHORT myshort;
    int thekey; //#define VK_NUMLOCK        0x90 can be found in winuser.h (Wim)

    thekey=144; //this should be 0x90 VK_NUMLOCK

    myshort = GetKeyState(thekey);
    printf("Programmed by Wim Peeters\n");
    //printf("your NUMLOCK key is %d\n",myshort);
        printf("NUMLOCK is already on\n");
        printf("NUMLOCK is off, switching it to on\n");       

    return 0;


You can search the download page for this application in compiled form. You can easily use it in a logonscript to set NUMLOCK.

The following will do this in vbscript:

    Set oShell = WScript.CreateObject ("") "cmd /C CD C:\ & %logonserver%\netlogon\NUMLOCK-on.exe"



The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.