Buscar

Chamando uma dll

Código


unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
    Form1: TForm1;

implementation

{$R *.dfm}
{funções da DLL Delphi}
function Double (N: Integer): Integer;
    stdcall; external 'MINHADLL.DLL';
function Triple (N: Integer): Integer;
    stdcall; external 'MINHADLL.DLL';

procedure TForm1.Button1Click(Sender: TObject);
var x, y: integer;
begin
    x := StrToInt(Edit1.Text);
    y := Double(x);
    Edit1.Text := IntToStr(y);
end;

procedure TForm1.Button2Click(Sender: TObject);
var x, y: integer;
begin
    x := StrToInt(Edit2.Text);
    y := Triple(x);
    Edit2.Text := IntToStr(y);
end;

end.

 

Bem pessoal por hoje é só. Na próxima semana tem mais.

Um forte abraço,

 

Publicidade

Vote na dica




Quantidade de votos: 0 votos
Aceitação: 0%


Detalhes da dica

Categoria: Object pascal
Adicionada dia: 09/02/05
Por: Jose Ribeiro
Visualizada: 3863 vezes

Planeta Delphi - Tudo sobre programação Delphi Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009