Fórum DLL Visual C/C , programa em Delphi #336492
19/01/2007
0
boa tarde, tenho uma dll que foi desenvolvida em Visutal C/C++ como eu consigo trabalhar com essar dll no delphi??
obrigado.
obrigado.
Ademirssilva
Curtir tópico
+ 0
Responder
Posts
19/01/2007
Delphijean
// Veja este exemplo.
// ===============
unit unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
// chama a função que estar numa dll
function Max(a, b : double):double; stdcall;
// atente para o uso de ´stdcall´;
var
Form1: TForm1;
implementation
{$R *.DFM}
function Max(a, b : double):double;external ´MaxDLL´;
procedure TForm1.Button1Click(Sender: TObject);
var
x, y, resultado : double;
begin
x := StrToFloat(Edit1.Text);
y := StrToFloat(Edit2.Text);
resultado := Max(x,y);
ShowMessage(´Valor Máximo ´ +FloatToStr(resultado));
end;
end.
espero que ajude;
jean@3soft.com.br
// ===============
unit unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
// chama a função que estar numa dll
function Max(a, b : double):double; stdcall;
// atente para o uso de ´stdcall´;
var
Form1: TForm1;
implementation
{$R *.DFM}
function Max(a, b : double):double;external ´MaxDLL´;
procedure TForm1.Button1Click(Sender: TObject);
var
x, y, resultado : double;
begin
x := StrToFloat(Edit1.Text);
y := StrToFloat(Edit2.Text);
resultado := Max(x,y);
ShowMessage(´Valor Máximo ´ +FloatToStr(resultado));
end;
end.
espero que ajude;
jean@3soft.com.br
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)