{$X+,O+,F+}
unit KeyName;

interface

function GetKeyName(Key: Word): String;

implementation

function GetKeyName(Key: Word): String;
begin
  case Key of
	0: GetKeyName := '';
    $011B: GetKeyName := 'Esc';
    $0100: GetKeyName := 'Alt+Back';
    $0200: GetKeyName := 'Alt+Space';
    $0300: GetKeyName := 'Ctrl+@';
    $0400: GetKeyName := 'Ctrl+Ins';
    $0500: GetKeyName := 'Shift+Ins';
    $0600: GetKeyName := 'Ctrl+Del';
    $0700: GetKeyName := 'Shift+Del';
    $0800: GetKeyName := 'Ctrl+Up';
    $0900: GetKeyName := 'Ctrl+Down';
    $0A00: GetKeyName := 'Alt+Right';
    $0B00: GetKeyName := 'Alt+Left';
    $0C00: GetKeyName := 'Alt+Up';
    $0D00: GetKeyName := 'Alt+Down';
    $0E00: GetKeyName := 'Alt+Ins';
    $0E08: GetKeyName := 'Back';
    $0E7F: GetKeyName := 'Ctrl+Back';
    $0F00: GetKeyName := 'Shift+Tab';
    $0F09: GetKeyName := 'Tab';
    $1000: GetKeyName := 'Alt+Q';
    $1100: GetKeyName := 'Alt+W';
    $1200: GetKeyName := 'Alt+E';
    $1300: GetKeyName := 'Alt+R';
    $1400: GetKeyName := 'Alt+T';
    $1500: GetKeyName := 'Alt+Y';
    $1600: GetKeyName := 'Alt+U';
    $1700: GetKeyName := 'Alt+I';
    $1800: GetKeyName := 'Alt+O';
    $1900: GetKeyName := 'Alt+P';
    $1A00: GetKeyName := 'Alt+~';
    $1B00: GetKeyName := 'Alt+}';
    $1C0A: GetKeyName := 'Ctrl+Enter';
    $1C0D: GetKeyName := 'Enter';
    $1E00: GetKeyName := 'Alt+A';
    $1F00: GetKeyName := 'Alt+S';
    $2000: GetKeyName := 'Alt+D';
    $2100: GetKeyName := 'Alt+F';
    $2200: GetKeyName := 'Alt+G';
    $2300: GetKeyName := 'Alt+H';
    $2400: GetKeyName := 'Alt+J';
    $2500: GetKeyName := 'Alt+K';
    $2600: GetKeyName := 'Alt+L';
    $2700: GetKeyName := 'Alt+:';
    $2800: GetKeyName := 'Alt+"';
    $2C00: GetKeyName := 'Alt+Z';
    $2D00: GetKeyName := 'Alt+X';
    $2E00: GetKeyName := 'Alt+C';
    $2F00: GetKeyName := 'Alt+V';
    $3000: GetKeyName := 'Alt+B';
    $3100: GetKeyName := 'Alt+N';
    $3200: GetKeyName := 'Alt+M';
    $3920: GetKeyName := 'Space';
    $3B00: GetKeyName := 'F1';
    $3C00: GetKeyName := 'F2';
    $3D00: GetKeyName := 'F3';
    $3E00: GetKeyName := 'F4';
    $3F00: GetKeyName := 'F5';
    $4000: GetKeyName := 'F6';
    $4100: GetKeyName := 'F7';
    $4200: GetKeyName := 'F8';
    $4300: GetKeyName := 'F9';
    $4400: GetKeyName := 'F10';
    $4700: GetKeyName := 'Home';
    $4800: GetKeyName := 'Up';
    $4900: GetKeyName := 'PgUp';
    $4A2D: GetKeyName := 'Gray Minus';
    $4B00: GetKeyName := 'Left';
    $4D00: GetKeyName := 'Right';
    $4E2B: GetKeyName := 'Gray Plus';
    $4F00: GetKeyName := 'End';
    $5000: GetKeyName := 'Down';
    $5100: GetKeyName := 'PgDn';
    $5200: GetKeyName := 'Ins';
    $5300: GetKeyName := 'Del';
    $5400: GetKeyName := 'Shift+F1';
    $5500: GetKeyName := 'Shift+F2';
    $5600: GetKeyName := 'Shift+F3';
    $5700: GetKeyName := 'Shift+F4';
    $5800: GetKeyName := 'Shift+F5';
    $5900: GetKeyName := 'Shift+F6';
    $5A00: GetKeyName := 'Shift+F7';
    $5B00: GetKeyName := 'Shift+F8';
    $5C00: GetKeyName := 'Shift+F9';
    $5D00: GetKeyName := 'Shift+F10';
    $5E00: GetKeyName := 'Ctrl+F1';
    $5F00: GetKeyName := 'Ctrl+F2';
    $6000: GetKeyName := 'Ctrl+F3';
    $6100: GetKeyName := 'Ctrl+F4';
    $6200: GetKeyName := 'Ctrl+F5';
    $6300: GetKeyName := 'Ctrl+F6';
    $6400: GetKeyName := 'Ctrl+F7';
    $6500: GetKeyName := 'Ctrl+F8';
    $6600: GetKeyName := 'Ctrl+F9';
    $6700: GetKeyName := 'Ctrl+F10';
    $6800: GetKeyName := 'Alt+F1';
    $6900: GetKeyName := 'Alt+F2';
    $6A00: GetKeyName := 'Alt+F3';
    $6B00: GetKeyName := 'Alt+F4';
    $6C00: GetKeyName := 'Alt+F5';
    $6D00: GetKeyName := 'Alt+F6';
    $6E00: GetKeyName := 'Alt+F7';
    $6F00: GetKeyName := 'Alt+F8';
    $7000: GetKeyName := 'Alt+F9';
    $7100: GetKeyName := 'Alt+F10';
    $7200: GetKeyName := 'Ctrl+PrScr';
    $7300: GetKeyName := 'Ctrl+Left';
    $7400: GetKeyName := 'Ctrl+Right';
    $7500: GetKeyName := 'Ctrl+End';
    $7600: GetKeyName := 'Ctrl+PgDn';
    $7700: GetKeyName := 'Ctrl+Home';
    $7800: GetKeyName := 'Alt+1';
    $7900: GetKeyName := 'Alt+2';
    $7A00: GetKeyName := 'Alt+3';
    $7B00: GetKeyName := 'Alt+4';
    $7C00: GetKeyName := 'Alt+5';
    $7D00: GetKeyName := 'Alt+6';
    $7E00: GetKeyName := 'Alt+7';
    $7F00: GetKeyName := 'Alt+8';
    $8000: GetKeyName := 'Alt+9';
    $8100: GetKeyName := 'Alt+0';
    $8200: GetKeyName := 'Alt+Minus';
    $8300: GetKeyName := 'Alt+Equal';
    $8400: GetKeyName := 'Ctrl+PgUp';
    $8500: GetKeyName := 'Alt+PgUp';
    $8600: GetKeyName := 'Alt+PgDn';
    $8700: GetKeyName := 'Alt+Home';
    $8800: GetKeyName := 'Alt+End';
    $8900: GetKeyName := 'Alt+Del';
    $8A00: GetKeyName := 'F11';
    $8B00: GetKeyName := 'F12';
    $8C00: GetKeyName := 'Alt+F11';
    $8D00: GetKeyName := 'Alt+F12';
    $8E00: GetKeyName := 'Ctrl+F11';
    $8F00: GetKeyName := 'Ctrl+F12';
    $9000: GetKeyName := 'Shift+F11';
    $9100: GetKeyName := 'Shift+F12';
    $9200: GetKeyName := 'Alt+\';
    $9300: GetKeyName := 'Alt+<';
    $9400: GetKeyName := 'Alt+>';
    $9500: GetKeyName := 'Alt+?';
    $9600: GetKeyName := 'Alt+Tab';
    $9700: GetKeyName := 'Ctrl+Tab';
    $FFFF: GetKeyName := 'Sequence';
    else if Char(Key) in [^A..^_] then
	   GetKeyName := 'Ctrl+' + Char(Byte(Key) + $40)
    else   GetKeyName := Char(Key);
  end;
end;

end.
