How to access numlock

This is a discussion on How to access numlock within the C Programming forums, part of the General Programming Boards category; How would I turn numlock on and off in my progrqams? I want my program to "press numlock"....

  1. #1
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765

    How to access numlock

    How would I turn numlock on and off in my progrqams? I want my program to "press numlock".
    The world is waiting. I must leave you now.

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    I think the keystates are at 0x40,0x40-9x4f. You will need to check a ports listing like the one provided in RBIL or look up some docs on keyboard programming.

    There are several approaches to this.

  3. #3
    Im a Capricorn vsriharsha's Avatar
    Join Date
    Feb 2002
    Posts
    192

    Thumbs up

    Hi There,
    I used the following method with out any problem...

    void main()
    {
    char far *f= (char far *)0x417;

    *f=*f | 32; /* *f OR'ed with 32 */

    }



    Bit 6 (from 1) at location 0x417 holds the toggle value of the NUM LOCK. U set it to 1 then the NUM LOCK is ON and 0 would turn it off. Happy working...

    best wishes,
    Sriharsha.
    Help everyone you can

  4. #4
    Registered User
    Join Date
    Dec 2001
    Posts
    227
    hhmm kool.. now would i creat this in linux.. and what header file would i need to add...

  5. #5
    Im a Capricorn vsriharsha's Avatar
    Join Date
    Feb 2002
    Posts
    192

    Unhappy

    O oo,
    I've never checked it all with linux (or even unix for that matter). I am not sure if this would work in linux. If DOS and Linux have the same information at memory locations 0x317 then it should work else I guess u should find another way out.
    NO HEADER file is needed for the program.
    Do something, Press the num lock to off.
    then run the program.
    If it gets turned on then ur program is working (in Linux) But be careful there is a small catch here. Once the num lock is on, it would simply get turned OFF if u hit the numlock key. To get around this problem (in DOS) I wrote a small TSR that would get fired when ever the user presses any keyboard on the keyboard ( and in that routine, I always turned the NUM lock on).
    Lemme know if u still have doubts (in DOS).

    Regards,
    Sriharsha
    Help everyone you can

  6. #6
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765

    boy oh boy

    I'll try out the information in your replies vsriharsha. I am running in Windows 98SE console though. I've been sicker than a dog for the past who knows how long, so sorry for the wait on my responses ( and any errors as i still feel out of it ).
    The world is waiting. I must leave you now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. access to devices
    By pastitprogram in forum C++ Programming
    Replies: 1
    Last Post: 06-06-2008, 11:16 PM
  2. Order of access labels in class definition
    By Mario F. in forum C++ Programming
    Replies: 10
    Last Post: 06-16-2006, 07:13 AM
  3. ww hosting and SSH access
    By spoon_ in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 04-07-2005, 08:49 AM
  4. Replies: 3
    Last Post: 09-22-2003, 09:48 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21