procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
IF KEY=#13 THEN
edit2.SetFocus
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
IF (LENGTH(EDIT1.Text)>0)AND(LENGTH(EDIT2.Text)>0)THEN
bitbtn1.Enabled:=TRUE
ELSE
bitbtn1.Enabled:=FALSE
end;
procedure TForm1.Edit2Change(Sender: TObject);
begin
IF (LENGTH(EDIT1.Text)>0)AND(LENGTH(EDIT2.Text)>0)THEN
bitbtn1.Enabled:=TRUE
ELSE
bitbtn1.Enabled:=FALSE
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
IF((LOWERCASE(EDIT1.Text)='tengo')and(LOWERCASE(EDIT2.Text)='sueño'))then
begin
timer1.enabled:=False;
MESSAGEDLG('INGRESO AL SISTEMA CORRECTAMENTE'#13'BIENVENIDO ',MTINFORMATION,[mbOK],1);
close
end
else if FORM1.Tag<4>=4 THEN
BEGIN
TIMER1.ENABLED:=FALSE;
MESSAGEDLG('USUARIO NO AUTORIZADO',MTWARNING,[MbOK],1);
close
end
else
begin
FORM1.Tag:=FORM1.Tag+1;
EDIT1.SelStart:=0;
EDIT1.SelLength:=LENGTH(EDIT1.Text);
EDIT1.CLEAR;
EDIT2.CLEAR;
EDIT1.SetFocus
END;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
label4.Caption:='le resta '+inttostr(timer1.Tag)+' seg';
TIMER1.Tag:=TIMER1.Tag-1;
IF TIMER1.Tag=0 THEN
BEGIN
TIMER1.Enabled:=FALSE;
LABEL4.Caption:='';
APPLICATION.MessageBox('SE CERRARA EL SISTEMA',' TIEMPO AGOTADO',MB_OK);
CLOSE
end;
end;
begin
IF KEY=#13 THEN
edit2.SetFocus
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
IF (LENGTH(EDIT1.Text)>0)AND(LENGTH(EDIT2.Text)>0)THEN
bitbtn1.Enabled:=TRUE
ELSE
bitbtn1.Enabled:=FALSE
end;
procedure TForm1.Edit2Change(Sender: TObject);
begin
IF (LENGTH(EDIT1.Text)>0)AND(LENGTH(EDIT2.Text)>0)THEN
bitbtn1.Enabled:=TRUE
ELSE
bitbtn1.Enabled:=FALSE
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
IF((LOWERCASE(EDIT1.Text)='tengo')and(LOWERCASE(EDIT2.Text)='sueño'))then
begin
timer1.enabled:=False;
MESSAGEDLG('INGRESO AL SISTEMA CORRECTAMENTE'#13'BIENVENIDO ',MTINFORMATION,[mbOK],1);
close
end
else if FORM1.Tag<4>=4 THEN
BEGIN
TIMER1.ENABLED:=FALSE;
MESSAGEDLG('USUARIO NO AUTORIZADO',MTWARNING,[MbOK],1);
close
end
else
begin
FORM1.Tag:=FORM1.Tag+1;
EDIT1.SelStart:=0;
EDIT1.SelLength:=LENGTH(EDIT1.Text);
EDIT1.CLEAR;
EDIT2.CLEAR;
EDIT1.SetFocus
END;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
label4.Caption:='le resta '+inttostr(timer1.Tag)+' seg';
TIMER1.Tag:=TIMER1.Tag-1;
IF TIMER1.Tag=0 THEN
BEGIN
TIMER1.Enabled:=FALSE;
LABEL4.Caption:='';
APPLICATION.MessageBox('SE CERRARA EL SISTEMA',' TIEMPO AGOTADO',MB_OK);
CLOSE
end;
end;
end.