小
小天
Unregistered / Unconfirmed
GUEST, unregistred user!
①FirstDLL.DLL文件
library FirstDLL;
uses
SysUtils, Classes,
Forms, ActiveX,
Ufirst in 'Ufirst.pas' {firstForm};
{$R *.RES}
procedure OpenfirstForm(cl:String;l,t,w,h:Integer);stdcall;
begin
Application.CreateForm(TfirstForm, firstForm);
firstForm.CurrLanguage:=cl;
firstForm.FormLeft:=l;
firstForm.FormTop:=t;
firstForm.FormWidth:=w;
firstForm.FormHeight:=h;
firstForm.Show;
end;
procedure ClosefirstForm;stdcall;
begin
firstForm.Free;
end;
exports
OpenfirstForm,
ClosefirstForm;
begin
CoInitialize(nil);
end.
②主窗体Ufirst.pas文件
type
TfirstForm = class(TForm)
.
.
.
private
{ Private declarations }
public
CurrLanguage:string[2];
FormTop,FormLeft,FormWidth,FormHeight:Integer;
{ Public declarations }
end;
procedure TFirstForm.FormPaint(Sender: TObject);
begin
Left:=FormLeft;
Top:=FormTop;
Width:=FormWidth;
Height:=FormHeight;
End;
③调用
implementation
{$R *.DFM}
procedure OpenFirstForm(cl:String;l,t,w,h:Integer);stdcall; external ' FirstDLL.dll';
procedure CloseFirstForm;stdcall; external ' FirstDLL.dll';
.
.
.
procedure TForm1.FormCreate(Sender: TObject);
Begin
OpenFirstForm(‘cn’,0,0,640,480);
End;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
Begin
CloseFirstForm;
End;
此文件关闭时报错,请问这是什么原因呢?
library FirstDLL;
uses
SysUtils, Classes,
Forms, ActiveX,
Ufirst in 'Ufirst.pas' {firstForm};
{$R *.RES}
procedure OpenfirstForm(cl:String;l,t,w,h:Integer);stdcall;
begin
Application.CreateForm(TfirstForm, firstForm);
firstForm.CurrLanguage:=cl;
firstForm.FormLeft:=l;
firstForm.FormTop:=t;
firstForm.FormWidth:=w;
firstForm.FormHeight:=h;
firstForm.Show;
end;
procedure ClosefirstForm;stdcall;
begin
firstForm.Free;
end;
exports
OpenfirstForm,
ClosefirstForm;
begin
CoInitialize(nil);
end.
②主窗体Ufirst.pas文件
type
TfirstForm = class(TForm)
.
.
.
private
{ Private declarations }
public
CurrLanguage:string[2];
FormTop,FormLeft,FormWidth,FormHeight:Integer;
{ Public declarations }
end;
procedure TFirstForm.FormPaint(Sender: TObject);
begin
Left:=FormLeft;
Top:=FormTop;
Width:=FormWidth;
Height:=FormHeight;
End;
③调用
implementation
{$R *.DFM}
procedure OpenFirstForm(cl:String;l,t,w,h:Integer);stdcall; external ' FirstDLL.dll';
procedure CloseFirstForm;stdcall; external ' FirstDLL.dll';
.
.
.
procedure TForm1.FormCreate(Sender: TObject);
Begin
OpenFirstForm(‘cn’,0,0,640,480);
End;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
Begin
CloseFirstForm;
End;
此文件关闭时报错,请问这是什么原因呢?