Solved

Key parameter in OnKeyUp is wrong

Posted on 2002-06-24
5
761 Views
Last Modified: 2012-05-04
In a delphi OnKeyUp event, when I press the ';' on the keyboard the 'Key' parameter is set as 186 which corresponds to the character: 'º'. I have also noticed discrepencies with the ',' key. What's going on and how can I get find out accurately which key has been pressed?
0
Comment
Question by:Siband
  • 2
  • 2
5 Comments
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
i guess that could
depend on the keyboardlayout- and/or countrysetting
of the os

do you have a special keyboardlayout and/or country setting?
0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
next guess :-)

subtract just 127 from your value,
there may a flag set (bit 8?),
don't know the meaning at the moment
0
 

Author Comment

by:Siband
Comment Utility
Subtracting 127 works for the ';' key but it doesn't work for the ',' key. A comma should be 44 but the value of Key is 188 in this case! I am not using a special keyboard as far as I know and my windows keyboard setting is 'English (United Kingdom)' which is correct.
0
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 50 total points
Comment Utility
This is the Scancode not the ASCII-Key. You will have to compare to the VK_ constants. They only correspond with ASCII for the alphanumeric keys.
0
 

Author Comment

by:Siband
Comment Utility
Thanks, That cirtainly answered the question. I have only given a B grading because I still don't know where to find a comprehensive list of the VK_ constants. I had to poke around to find a few in the Windows.pas file but it was cirtainly not comprehensive and didn't contain the ones for ';' and ','. I thank you for pointing me in the right direction however.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

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…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 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

12 Experts available now in Live!

Get 1:1 Help Now