How do Ctrl + Key shortcuts combine in an OnKeyPress event?

I tried to detect Ctrl+ Vfrom the event TEdit OnKeyPress, and I noticed that the parameter Keytakes an unusual value when you press Ctrl+ AnyKey.

I prepared an example:

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
  ShowMessage(IntToStr(Ord(Key)));
end;

It produces the following results:

  • Ctrl+ Q17
  • Ctrl+ W23
  • Ctrl+ E5
  • Ctrl+ R18
  • ...
  • Ctrl+ A1
  • Ctrl+ Z26
  • Ctrl+ C3
  • Ctrl+ V22
  • Ctrl+ X24

I don’t understand how the keys are translated, what do these codes mean?

It seems to have nothing to do with the ASCII table :

enter image description here

Can anyone shed some light on this?

+4
1

, , ?

, Ctrl + AnyKey, - Ascii. () . () 32 del (127).

enter image description here

.

+4

Source: https://habr.com/ru/post/1694916/


All Articles