Solved

Need the name of a Key on the keyboard

Posted on 2004-10-17
13
1,117 Views
Last Modified: 2007-11-27
I've searched, I'ved looked, I'ved asked, no one knows.. please someone, could u tell me what they key is called above the TAB and left of 1 and tell me the keybd_event name of it as well, VK_ something?

I don't know the name, its nuts I know its on my tip of my tonge and I just can't think of the name of that key, the one above TAB and left of 1 the one right in the left corner.

could someone please tell me the name and the keybd_event

Sal.
0
Comment
Question by:SaLz
  • 3
  • 2
  • 2
  • +6
13 Comments
 
LVL 4

Assisted Solution

by:Evarest
Evarest earned 130 total points
ID: 12333908
It seems that that specific key doesn't have a virtual key code. These virtual key codes are essentially constants which hide the ordinal of the character. In the case of your character it's 178.

For example:

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
 if key = chr(VK_RETURN) then ShowMessage('done');
end;


will show a message dialog if the Return key is being pressed.

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
 if key = chr(13) then ShowMessage('done');
end;

would do the same.

Thus in your case:

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
 if key = chr(178) then ShowMessage('done');
end;

will do the trick :-)

Cheers!
Evarest
0
 
LVL 7

Expert Comment

by:sftweng
ID: 12334802
On my keyboard, the uppercase character is the "tilda" ~ and the lowercase is the opening single quote ` (distinct from the closing single quote ').
0
 
LVL 2

Author Comment

by:SaLz
ID: 12336234
on mine its ¬`¬¬¬¬```
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 12336286
Have a look at the functions MapVirtualKey and GetKeyNameText.
The key above Tab is '^' for a german keyboard and the letter is diacritic meaning it is a dead key.
0
 
LVL 12

Assisted Solution

by:Ivanov_G
Ivanov_G earned 70 total points
ID: 12336522
Blah ... KeyDown shows 192 as a code and KeyPress - 96. The VK_ codes are from KeyDown (as I remember)...
0
 
LVL 6

Expert Comment

by:Sergio_Hdez
ID: 12336537
In spanish keyb it is  "º ª \" key... but just write a prog that, on keypress shows you the code of the key pressed, then you get your integer magic number!
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 300 total points
ID: 12336963
On my system it's normally ` but ¬ if I press Shift too. With Alt Gr it becomes ¦ which is different from | since it has a small gap in the middle. (And | is above the \ on the left of the Z.)
In Dutch the ' is called the "Accent Aigu" and the ` the "Accent Grave" and since these words are from french origine, I assume they're called the same in English. But they're only called accents if they're combined with some other letter, preferably a vowel.

The ' and ` are also accessible through their ANSI codes... #39 for ' and #96 for `. There are no special VK_ names for them. However, depending on your keyboard settings it could happen that they're silent, to be merged with the next character that's going to be typed. In that case, they are dead keys. Dead keys generate a WM_KEYDOWN event that is translated to a WM_DEADCHAR message. The next keystroke will generate a WM_CHAR message that will contain the last-pressed character combined with the accent or other diacretic. If no combination is possible, two WM_CHAR messages are generated. One for the dead key that gets resurrected and one for the other key.
In general, let Windows handle these dead keys for you. It's easier. :-)

If you want to check for this key, the ASCII code is 96, so you could define this:

const
  VK_ACCENTGRAVE = 96;
  VK_ACCENTAIGU = 39;

and use above constants. But I think these codes conflict with the virtual keys defined by Windows. Virtual keys are, in general, special function keys while what you want are either dead keys or non-virtual keys.
0
 
LVL 5

Expert Comment

by:snehanshu
ID: 12337079
Sal,
  If I understand correctly, you want to know what the character "~" is called.
  Well, ~ is tilda.
  And... there's an easy way to know the pronunciation of each character, here's what you can do:
  1. Start On Screen Keyboard:
  Start->All Programs->Accessories-> Accessibilities->On Screen Keyboard.

  2. Start Narator:
  Start->All Programs->Accessories-> Accessibilities->Narrator.

  Now, narrator will pronounce for you whatever character you click on or place your mouse cursor on.

  As others have pointed out, there is no VK_ equivalent of ~ in delphi, but the virtual key code is 192.

Cheers!
...Shu
0
 
LVL 2

Author Comment

by:SaLz
ID: 12337460
lol, guess everyones keyboard layout is diffrent :P am sorry 2 asume it would be the same lol
0
 

Expert Comment

by:Delphi-Lover
ID: 12337535
Hello,

The word you looking for is "Tilde".
In many languages this sign is called this way.

Greets,

Delphi Lover.

The lines of the form alias <AE00> = <TLDE>; allow alternate names to be associated with the same key. In the example given, the tilde key, associated with the key code 49 in this keyboard can also be referred to as <AE00> as well as <TLDE>. This facility is useful if you want to refer, sometimes, to ``the leftmost key of the top row'' rather than ``the tilde key''.
0
 
LVL 2

Author Comment

by:SaLz
ID: 12337650
ok I got it 2 work, the code for ` is 96 in the ascii table, but whats the name of the ` marker, the ~ is the tilda, thats with my hash key, but if everybodys key layouts is diffrent, I'm guessing it doesn't matter anymore and its a real bummer, cos that key up in the top left is the key I want 2 use lol, will have 2 use the standard keys instead, or the numpads.

well, I thank u all for helpin me, u've showed me that the none standard keys are diffrent on all peoples keyboards, will have 2 make the program so the user can select there own key instead, it would make things easier as well, but more work on my part lol, u got any code 2 be able 2 do that, I may have 2 post another question for that later on :oD

Sal.
0
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12337980
Yeah, keyboard layouts can be a real pain sometimes. Ever used a french AZERTY keyboard? :-) Yep, you guessed it, it even has the letter keys in a different order.
Besides, the number of keyboard layouts are quite huge. The country for which the keyboard is made also makes a big difference. E.g. the german keyboard is different from the Dutch keyboard, even though the languages use mostly the same characters. The ß for example is used often in the German language. Yet it's one of the characters with no fixed ASCII code. (It differs per font.) But the ß is located on the German keyboard. Norway and Sweden also have lots of diacretics in their languages but fortunately they don't need any real adjustments. Japanese and Chinese keyboards however are completely different though. The same is true for Arabic and Hebrew keyboards. If you have to keep track of the keyboard that is used then your development life becomes a real nightmare.

Add a THotkey component on your form. It's in the Win32 component palette. It's made especially to allow users to provide a valid hotkey.
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 12338519
To add to Workshop_Alex:
GetKeyNameText is also a PITA. It gives the localized names of the keys.
The tables to handle the names have been reimplemented for Windows 2000.
There are Bugs/differences in the tables like 'ü' instead of the correct 'Ü' for example.
Also many key names are in all uppercase.
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

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…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

19 Experts available now in Live!

Get 1:1 Help Now