unit Input;

interface

uses
  SysUtils, Windows, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls, Buttons;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

function Get_Key(Dummy: Integer): Integer; export;

implementation

{$R *.DFM}

function Get_Key(Dummy: Integer): Integer;
var
 KeyForm: TForm1;
 TempStr: String;
 RetCode: Integer;
begin
 { Tworzymy formularz }
 KeyForm := TForm1.Create(Application);
 { Zerujemy pole edycji }
 KeyForm.Edit1.Text := '';
 { Ustawiamy domyln warto zwracan przez funkcj }
 Get_Key := -1;

 try
   with KeyForm do
    if ShowModal = mrOK then  { jeli uyto klawisza OK... }
     begin
      TempStr := Edit1.Text;
      RetCode := Ord(TempStr[1]);
      Get_Key := RetCode;
     end
    else                      { ...w przeciwnym wypadku }
     begin
      Get_Key := 0;
     end;
 finally
   KeyForm.Free;
 end;
end;

end.