W
wulfalone
Unregistered / Unconfirmed
GUEST, unregistred user!
是动态调用dll的。
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Tmyproc = function(x,y:integer):integer;
var
Form1: TForm1;
myproc:Tmyproc;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
myh: thandle;
i:integer;
begin
myh:=loadlibrary('Project1.dll');
if myh <>0 then
begin
@myproc := getprocaddress(myh,'min');
i:=myproc(89,111);
form1.Edit1.Text :=inttostr(i);
end;
freelibrary(myh);
end;
end.
unit Unit3;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Tmyproc = function(x,y:integer):integer;
var
Form1: TForm1;
myproc:Tmyproc;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
myh: thandle;
i:integer;
begin
myh:=loadlibrary('Project1.dll');
if myh <>0 then
begin
@myproc := getprocaddress(myh,'min');
i:=myproc(89,111);
form1.Edit1.Text :=inttostr(i);
end;
freelibrary(myh);
end;
end.