Mega Code Archive

 
Categories / Delphi / Strings
 

Get ASCII code of pressed key

Title: Get ASCII code of pressed key Set KeyPreview property of Form to True and use onKeyDown event. This event has Key parameter. It is a ASCII code of key. procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin Label1.Caption:=Chr(Key)+' - '+IntToStr(Key); end;