Windows DatabaseebooksStatistical Information

LWE10054 : A windows C application for activating the NUMLOCK key

Symptom:

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

Cause:

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

Solution:

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);
    if(myshort==1)
    {
        printf("NUMLOCK is already on\n");
    }
    else
    {
        printf("NUMLOCK is off, switching it to on\n");       
        keybd_event(thekey,1,0,0);
        keybd_event(thekey,1,KEYEVENTF_KEYUP,0);
    }

    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 ("WSCript.shell")
    oShell.run "cmd /C CD C:\ & %logonserver%\netlogon\NUMLOCK-on.exe"

 


Disclaimer:

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!
Copyright © 2004-2011 Lubby (V3.0.10 Aug 2011)
Sponsored by Keskon.
Statistical information by Google Analytics