Solved

Caps lock on/off

Posted on 1998-01-05
5
213 Views
Last Modified: 2010-04-04
How do I turn Caps lock, scroll lock and num lock on or off
0
Comment
Question by:koger
  • 3
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
ronit051397 earned 20 total points
ID: 1355276
Here is some code:

procedure TForm1.Button1Click(Sender: TObject);
begin
IF GetKeyState(VK_CAPITAL)=0 THEN showmessage('Caps lock is Off');//1=ON
IF GetKeyState(VK_NUMLOCK)=0 THEN showmessage('Num lock is Off');
IF GetKeyState(VK_SCROLL)=0 THEN showmessage('Scroll lock is Off');
//we send key accelerators
keybd_event(VK_CAPITAL,0,0,0);
keybd_event(VK_CAPITAL,0,KEYEVENTF_KEYUP,0);
keybd_event(VK_NUMLOCK,0,0,0);
keybd_event(VK_NUMLOCK,0,KEYEVENTF_KEYUP,0);
keybd_event(VK_SCROLL,0,0,0);
keybd_event(VK_SCROLL,0,KEYEVENTF_KEYUP,0);
end;

0
 

Author Comment

by:koger
ID: 1355277
I don't seem to get the code to work properly in Win95, but under Win NT, it works great, do you have a clue why this doesn't work.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1355278
I have also tested it under WinNT. As for Win95 I'll Check.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1355279
I checked on win95 and only the numlock didn't work but the others did. I Don't know why this is happening.
0
 

Author Comment

by:koger
ID: 1355280
The same happent to me, guees thats just the Win95 is, I will try asking some Win95 experts, thanks for your help.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now