Solved

Caps lock on/off

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

766 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