I. Obtenir le code des touches clavier▲
Créer un nouveau projet avec une Form (Form1) avec sa propriété KeyPreview à true et un Label (Label1).
Sur l'événement OnKeyDown de Form1 :
Sélectionnez
void
__fastcall TForm1::
FormKeyDown(TObject *
Sender, WORD &
Key,
TShiftState Shift)
{
char
ch[3
];
wsprintf(ch,"%X"
,Key);
Label1->
Caption =
"0x"
+
String(ch);
}
À l'appui d'une touche, son code s'affiche sur Label1.