Solved

Detecting the keyboard status

Posted on 1997-11-28
2
149 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
[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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

717 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