[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
    Search the FAQ Archives

Part1 - Part2 - Part3 - Part4 - Part5 - Single Page

Top Document: comp.os.msdos.programmer FAQ part 2/5
Previous Document: - How can I disable the print screen function?
Next Document: - How can I speed up the keyboard's auto-repeat?


- How can my program turn NumLock (CapsLock, ScrollLock) on or off?


Date: 12 Sep 2002 17:46:15 -0400

 First, if you just don't want NumLock turned on when you reboot, check
 your system's setups. (Press a special key like Del at boot time, or run
 the setup program supplied with your system.) Many systems may have an
 option in setup to turn NumLock off at boot time.

 You need to twiddle bit 5, 6, or 4 of location 0040:0017. The code
 example below demonstrates changing NumLock status: lck() turns on a
 lock state, and unlck() turns it off.

   /* The  status  lights on some keyboards may not reflect  the
    * change.   If  yours  is one, call INT 16 AH=2,  "get  shift
    * status", and that may update them.  It will certainly do no
    * harm.)
    */
 
    #define NUM_LOCK  (1 << 5)
    #define CAPS_LOCK (1 << 6)
    #define SCRL_LOCK (1 << 4)
  
    void lck(int shiftype)
    {
      char far* kbdstatus = (char far*)0x00400017UL;
      *kbdstatus |= (char)shiftype;
    }
    void unlck(int shiftype)
    {
      char far* kbdstatus = (char far*)0x00400017UL;
      *kbdstatus &= ~(char)shiftype;
    }



Top Document: comp.os.msdos.programmer FAQ part 2/5
Previous Document: - How can I disable the print screen function?
Next Document: - How can I speed up the keyboard's auto-repeat?

Part1 - Part2 - Part3 - Part4 - Part5 - Single Page


[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
jeffrey@carlyle.org (Jeffrey Carlyle)

Last Update October 22 2009 @ 05:28 AM

Some parts © 2009 Advameg, Inc.