Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Turn Off Caps Lock (Dos C Program)

Posted on 1997-12-18
7
Medium Priority
?
750 Views
Last Modified: 2008-03-17
I have a c DOS program running on an old 386 and need to turn off the caps lock. How do I do this? (C or Assembly)
0
Comment
Question by:mikeu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 

Author Comment

by:mikeu
ID: 1256732
Adjusted points to 200
0
 
LVL 10

Accepted Solution

by:
rbr earned 1200 total points
ID: 1256733
To change the status of your keyboard you have the change to bios-values at 0x0040:0x0017

set_flag (int flag)
{
    char far *pflag;

    pflag = (char far *) (((unsigned long)0x40)<<16+(unsigned long) 0x17);

    *pflag |=flag
    _asm {
        mov ah,1
        int 16h
     }
}
clear_flag (int flag)
{
    char far *pflag;

    pflag = (char far *) (((unsigned long)0x40)<<16+(unsigned long) 0x17);

    *pflag &= ˜flag;
    _asm {
        mov ah,1
        int 16h
     }
}

flag = 16 Scroll lock
flag = 32 Num Lock
flag = 64 Caps Lock
0
 

Author Comment

by:mikeu
ID: 1256734
when I try your example in code view the value of the pointer pflag seems to be 0000:2000  not 0040:0017 ?!? am I just being stupid and missing something? Thanks for any Info
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:mikeu
ID: 1256735
This works pflag = (char far *)0x00000417L

0
 

Author Comment

by:mikeu
ID: 1256736
Very strange behavior. Which compiler to you use?
0
 
LVL 10

Expert Comment

by:rbr
ID: 1256737
Sorry, was a mistake of my book. Use instead of "<< 16" "* 16L" or "<< 4". This should work.
0
 
LVL 10

Expert Comment

by:rbr
ID: 1256738
I use Microsoft vc++ 1.52 for my dos stuff and 5.0 for windows.
I tried the *16L and it seems to work.
Thanks for your help
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question