M
ml.guo
Unregistered / Unconfirmed
GUEST, unregistred user!
Project1.dll,建立了一过程showform,显示一窗口fm1,
project2.exe调用project1.dll的showform。
问题:运行project2.exe时,总是先显示project1.dll的窗口fm1,关闭fm1后才弹出project2.exe有主窗口。
但是project2.exe中是要点击bitbtn按键才调用showform的。为什么??
---project1.dll
library Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {fm};
{$R *.res}
exports
showform;
begin
Application.Initialize;
Application.CreateForm(Tfm, fm);
Application.Run;
end.
---unit1.pas
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
Tfm = class(TForm)
Edit1: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
private
{ Private declarations }
public
{ Public declarations }
end;
var
fm: Tfm;
procedure showform;stdcall;
implementation
{$R *.dfm}
procedure showform;
begin
fm:=tfm.Create(application);
try
fm.ShowModal;
finally
fm.Free;
end;
end;
end.
--------------------------------
project2.exe
略
unit2.pas
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm2 = class(TForm)
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
procedure showform;stdcall;external 'project1.dll';
implementation
{$R *.dfm}
procedure TForm2.BitBtn1Click(Sender: TObject);
begin
showform;
end;
end.
project2.exe调用project1.dll的showform。
问题:运行project2.exe时,总是先显示project1.dll的窗口fm1,关闭fm1后才弹出project2.exe有主窗口。
但是project2.exe中是要点击bitbtn按键才调用showform的。为什么??
---project1.dll
library Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {fm};
{$R *.res}
exports
showform;
begin
Application.Initialize;
Application.CreateForm(Tfm, fm);
Application.Run;
end.
---unit1.pas
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
Tfm = class(TForm)
Edit1: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
private
{ Private declarations }
public
{ Public declarations }
end;
var
fm: Tfm;
procedure showform;stdcall;
implementation
{$R *.dfm}
procedure showform;
begin
fm:=tfm.Create(application);
try
fm.ShowModal;
finally
fm.Free;
end;
end;
end.
--------------------------------
project2.exe
略
unit2.pas
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm2 = class(TForm)
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
procedure showform;stdcall;external 'project1.dll';
implementation
{$R *.dfm}
procedure TForm2.BitBtn1Click(Sender: TObject);
begin
showform;
end;
end.