unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls,
  { MOJE }
  UHeaders; // nagłówek exportowanej procedury

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    btnCLOSE: TBitBtn;
    btnRysuj: TBitBtn;
    btnGetLibVersion: TBitBtn;
    btnNI: TBitBtn;
    btnKWADRAT: TBitBtn;
    procedure btnKWADRATClick(Sender: TObject);
    procedure btnNIClick(Sender: TObject);
    procedure btnGetLibVersionClick(Sender: TObject);
    procedure btnCLOSEClick(Sender: TObject);
    procedure btnRysujClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);

  private
    function Proba() : PChar; 
  public

  end;

var
  Form1: TForm1;

implementation
{$R *.dfm}
{------------------------------------------------------------------------------}
procedure TForm1.FormCreate(Sender: TObject);
var
   fn_dll : String;

begin
	fn_dll := ExtractFilePath(Application.ExeName) + 'pierwsza.dll';
	if not FileExists(fn_dll) then
   begin
      ShowMessage('Brak pliku DLL');
      Application.Terminate();
   end;
end;

function TForm1.Proba() : PChar;
var
   wersja : String;

begin
	wersja := 'Marian Wybrańczyk';
   Result := PChar(wersja);
end;

procedure TForm1.btnCLOSEClick(Sender: TObject);
begin
	Close();
end;

procedure TForm1.btnRysujClick(Sender: TObject);
var
   ACanvas : TCanvas;

begin
   ACanvas := Form1.Canvas;
	Rysuj(ACanvas);
end;

procedure TForm1.btnGetLibVersionClick(Sender: TObject);
var
   ps : PChar;
begin
   ps := GetLibVersion();
   ShowMessage(ps);
end;

procedure TForm1.btnKWADRATClick(Sender: TObject);
var
	cyfra : Integer;
   wynik : LongInt;

begin
	cyfra := 12;
   wynik := Kwadrat(cyfra);
   ShowMessage(IntToStr(cyfra) + ' do kweaqdratu = ' + IntToStr(wynik));
end;

procedure TForm1.btnNIClick(Sender: TObject);
var
	nazwisko : PChar;
   imie     : PChar;

begin
   GetNI(nazwisko, imie);
	ShowMessage(nazwisko + ' ' + imie);
end;

end.

