主窗口启动显示后用ShowModal显示别外一窗口,代码怎么写?谢(50分)

  • 主题发起人 主题发起人 YongSoft
  • 开始时间 开始时间
Y

YongSoft

Unregistered / Unconfirmed
GUEST, unregistred user!
主窗口启动显示后用ShowModal显示别外一窗口,代码怎么写?谢
 
uses TOtherForm;

begin
with TOtherForm.Create(Self) do
try
ShowModal;
finally
Free;
end;
end;
 
=>
加代如入主窗口那个过程中
 
procedure TForm1.FormShow(Sender: TObject);
var
form3:Tform;
begin
form3:=Tform.Create(application);
try
form3.ShowModal;
except
form3.Free;
end;
end;
 
to chobits:
不是except,是finally
 
没用,我试过
 
在project中:
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.CreateForm(TForm2, Form2);
form2.ShowModal;
Application.Run;
 
放在工程里的RUN前
 
.....
frmLogin:=TFrmLogin.Create(Application);
try
FrmLogin.ShowModal;
finally
FrmLogin.Free;
end;
Application.Run;
 
program FDGL;

uses
Forms,
Dialogs,
PasZCX in 'PasZCX.pas' {FRMZCX},
PASSZWK in 'PASSZWK.pas' {FRMSZWK},
PasSZXZ in 'PasSZXZ.pas' {FrmSZXZ},
pasCZDL in 'pasCZDL.pas' {FrmCZDL},
Paszjcz in 'Paszjcz.pas' {FrmZJCZ},
PasAEZ in 'PasAEZ.pas' {FrmAEZ},
PasJBXR in 'PasJBXR.pas' {FrmJBXR},
PasGGDM in 'PasGGDM.pas',
PasZJNH in 'PasZJNH.pas' {FrmZJNH},
PasEZJNH in 'PasEZJNH.pas' {FrmEZJNH},
pasFDFA in 'pasFDFA.pas' {FrmFDFA},
PasFJJS in 'PasFJJS.pas' {FrmFJJS},
pasNHFC in 'pasNHFC.pas' {FrmNHFC},
pasYHGL in 'pasYHGL.pas' {FrmYHGL},
PasUseLog in 'PasUseLog.pas' {FrmLogFDSL},
pasZXYH in 'pasZXYH.pas' {FrmZXYH},
PasJFCL in 'PasJFCL.pas' {FrmJFCL},
pasZL in 'pasZL.pas' {FrmZL},
PasXTOption in 'PasXTOption.pas' {FrmXTOption},
Registry,
SysUtils;

{$R *.res}
Var
FileDB : Boolean;
begin
Application.Initialize;
Application.Title := '件';
//系统数据库是否存在不存在
FileDB :=False;
With Tregistry.Create do
Begin
IF OpenKey('FBGLDB',True) Then
IF ValueExists('Path') Then
Begin
SysDB:=ReadString('Path');
IF FileExists(SysDB) Then
FileDB:=True;
End;
Free;
End;

IF Not FileDB Then
With TFRMSZWK.Create(Application) Do
Begin
EditPath.Text:=SysDB;
IF ShowModal=2 Then
Begin
Application.Terminate;
Exit;
End;
Free;
End;

With TFrmLogFDSL.Create(Application) Do
Begin
IF ShowModal=6 then
Begin
Application.CreateForm(TFRMZCX, FRMZCX);
With TFrmXTOption.Create(Application) Do
Begin
ShowModal;
Free;
End;
Application.Run;
End
Else
Application.Terminate;
End;

end.
 
主窗体前显示加在主窗体OnCreate事件
要将那个显示窗体的自动创建移去
 
Application.CreateForm(TFrmMain, FrmMain);
FrmMain.Show;
FrmMain.Update;
frmLogin:=TFrmLogin.Create(Application);
try
FrmLogin.ShowModal;
finally
FrmLogin.Free;
end;
Application.Run;
 
多人接受答案了。
 

Similar threads

后退
顶部