Solved

Detecting the keyboard status

Posted on 1997-11-28
2
146 Views
Last Modified: 2010-04-04
How do I detect whether the Caps Lock, Num Lock, etc
keys are enabled?

Thanks in advance
Email: wenwei@mbox2.singnet.com.sg
0
Comment
Question by:test031097
2 Comments
 
LVL 3

Accepted Solution

by:
d4jaj1 earned 50 total points
ID: 1352344
You'd use the getkeystate method.  Suppose you wanted to display CAPS or INSERT to a statuspanel.  Add the code below to a Timer component (or what ever you want to kick this off, like them actually pressing the CAPS or Insert keys)

if odd (getkeystate (VK_CAPITAL)) then
   statusbar1.panels[2].text := 'CAPS'
else
   statusbar1.panels[2].text := '';

For the insert key, use VK_INSERT.  The entire VK listing is in the Delphi help file.  Any questions, please add a comment.

Good Luck!
Jay
0
 

Author Comment

by:test031097
ID: 1352345
Thanks a lot!!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Title # Comments Views Activity
how can i search if string exist in array ? 3 63
Delphi...Split view - idea? 1 90
Drag & Drop... Data from one grid to another 2 42
Delphi: making a BW image transparent 10 62
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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

830 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