B
babyrun
Unregistered / Unconfirmed
GUEST, unregistred user!
[]一段登陆验证的代码,在密码输入不正确的情况下为什么还会显示主程序?
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {PasswordDlg};
{$R *.res}
begin
Application.Initialize;
PasswordDlg:=TPasswordDlg.Create(Application);
PasswordDlg.ShowModal;//--->登陆验证有误的情况下,应该继续停留在登陆窗口
Application.CreateForm(TForm1, Form1); //--->为什么验证有误的情况下还会继续执行?
Application.Run;
end.
======================================================
procedure TPasswordDlg.OKBtnClick(Sender: TObject);
begin
if Trim(Password.Text)='' then
begin
MessageBox(Handle,'请输入密码!','系统提示',MB_ICONINFORMATION or MB_OK);
Password.SetFocus;
Exit; //--->无法结束程序,
end;
end;
end.
program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {PasswordDlg};
{$R *.res}
begin
Application.Initialize;
PasswordDlg:=TPasswordDlg.Create(Application);
PasswordDlg.ShowModal;//--->登陆验证有误的情况下,应该继续停留在登陆窗口
Application.CreateForm(TForm1, Form1); //--->为什么验证有误的情况下还会继续执行?
Application.Run;
end.
======================================================
procedure TPasswordDlg.OKBtnClick(Sender: TObject);
begin
if Trim(Password.Text)='' then
begin
MessageBox(Handle,'请输入密码!','系统提示',MB_ICONINFORMATION or MB_OK);
Password.SetFocus;
Exit; //--->无法结束程序,
end;
end;
end.