unit config2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,keyboard, ExtCtrls;

type
  TForm2 = class(TForm)
    Label1: TLabel;
    Button1: TButton;
    Timer1: TTimer;
    procedure Button1Click(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;
  var a1,a2:string;
  ret,wroc:integer;
implementation

{$R *.dfm}


procedure TForm2.Button1Click(Sender: TObject);
begin
ret:=0;
close;
end;

procedure TForm2.FormActivate(Sender: TObject);
var
   keyCode : Integer;
   a:integer;
begin
wroc:=0;
//show;
label1.Caption:=a1;
button1.Caption:=a2;
   repeat
      Application.ProcessMessages;  // let other messages happen
     // Sleep(1);                     // relinquish time for other processes
      keyCode:=KeyPressed;
      //inc(a);
     /// caption:=inttostr(a);
   until (keyCode>=0) and (keyCode<>255);
   ret:=keycode;
      caption:=inttostr(keycode);
   label1.Caption:=virtualkeycodetokeyname(ret);
   wroc:=1;
//close;

end;

procedure TForm2.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin

//close;
end;

procedure TForm2.FormKeyPress(Sender: TObject; var Key: Char);
begin
//close;
end;

procedure TForm2.Timer1Timer(Sender: TObject);
begin
if wroc>0 then close;
end;

end.
