1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| unit Start;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Spin;
type
TForm1 = class(TForm)
Calcul: TButton;
A: TEdit;
B: TEdit;
Label1: TLabel;
Res: TEdit;
procedure FormCreate(Sender: TObject);
procedure CalculClick(Sender: TObject);
procedure AKeyPress(Sender: TObject; var Key: Char);
procedure BKeyPress(Sender: TObject; var Key: Char);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
const
NomDll = 'DLL1.dll';
// function Somme(A, B: Real): Real; stdcall; external NomDLL name 'Somme';
function Somme(A, B: Real): Real; stdcall; external NomDLL index 1;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
A.Text:='0';
B.Text:='0';
Res.Text:='0';
end;
procedure TForm1.CalculClick(Sender: TObject);
begin
Res.Text:=(Floattostr(Somme(strtofloat(A.text), strtofloat(B.text))));
end;
end. |
Partager