Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.os.msdos.programmer FAQ part 2/5
Section - - How can my program turn NumLock (CapsLock, ScrollLock) on or off?

( Part1 - Part2 - Part3 - Part4 - Part5 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Cities ]


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?
See reader questions & answers on this topic! - Help others by sharing your knowledge
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;
    }

User Contributions:

Comment about this article, ask questions, or add new information about this topic:

CAPTCHA




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 March 27 2014 @ 02:11 PM