Solved

Numlock & Caps lock  (Easy)

Posted on 1998-08-08
3
328 Views
Last Modified: 2010-04-04

How can i check the state of Numlock & Caps lock keys?

Thanks!!
0
Comment
Question by:dia050398
[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
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 70 total points
ID: 1361742
Hi dia,

function LowOrderBitSet( Value: integer ): boolean;
begin
 Result := (Value and 1 > 0);
end;

function CapsLock : boolean;
begin
 if LowOrderBitSet(GetKeyState(VK_CAPITAL))then Result := True
 else Result := False;
end;

function InsertOn: boolean;
 { Returns the status of the Insert key.    }
begin
 if LowOrderBitSet(GetKeyState(VK_INSERT))then Result := True
  else Result := False;
end;

function NumLock : boolean;
begin
 if LowOrderBitSet(GetKeyState(VK_NUMLOCK))then Result := True
  else Result := False;
end;

function ScrollLock : boolean;
begin
 if LowOrderBitSet(GetKeyState(VK_SCROLL))then Result := True
 else Result := False;
end;

This is a way.

Regards, Zif.
0
 

Author Comment

by:dia050398
ID: 1361743
Sometimes Numlock Doesn´t work
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1361744
weird... can you check when exactely?
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

738 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