Solved

Caps lock on/off

Posted on 1998-01-05
5
219 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

786 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