var passfile :textfile; passstr:string; begin assignfile(passfile,'e:\password\pass.txt'); reset(passfile); readln(passfile,passstr); closefile(passfile); times:=times+1; if edit2.Text=passstr then Form2.show else begin if MessageDlg('密码不正确,是否退出?',mtConfirmation,[mbYes,mbNo],0)=mryes then close else if times<3 then edit2.SetFocus else begin MessageDlg('对不起,密码不正确,请退出!', mtConfirmation,[mbOk],0); application.Terminate; end; end; end;