要求:当输入的用户名或密码错误时,提示“用户名或密码错误,你还剩3次登陆机会!” 再错就提示“用户名或密码错误,你还剩2次登陆机会!”......最后当3次输入的密码都不正确时退出系统!
if trim(MMEdit.Text) <> trim(pubQry.FieldByName(’uPas’).AsString) then begin Logintimes :=Logintimes + 1; if Logintimes < 3 then begin MessageBox(handle,pchar(’错误。密码第’+IntToStr(Logintimes)+’次错误,请重新输入’),’密码错误’,MB_OK OR MB_ICONERROR); MMEdit.Text:=’’; MMEdit.SetFocus; end else begin MessageBox(handle,’密码三次错误。系统将会关闭’,’密码错误’, MB_ICONERROR); Application.Terminate; end; end
|