Solved

Detecting the keyboard status

Posted on 1997-11-28
2
142 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
Comment Utility
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
Comment Utility
Thanks a lot!!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now