Código para bloquear programa quando ocioso!

Delphi

16/02/2006

galera é o seguinte, peguei esse código aqui mesmo no fórum mais não funcionou comigo, o tempo não zera, fiz alguns testes e não funcionou ele sempre continua a contagem...
pessoal não era bem isso que eu tinha em mente mas o resultado foi o esperado vou diexar aqui p/ quem tiver com o mesmo problema de usuário relaxado.... NO FORMULÁRIO PRINCIPAL DE SUA APLICAÇÃO, AJUSTE A PROPRIEDADE KeyPreview PARA true, INSIRA O COMPONENTE TTimer E AJUSTE O INTERVALO PARA 1000 MILESEGUNDOS --------------------------------------------- private procedure ResetTimeOut; public { Public declarations } end; ------------------------------------ implementation const maxTimeOutValue = 300; // 300 segundos = à 5 minutos var TimeOut : integer; // será incrementando pelo TTimer {$R *.dfm} procedure TForm1.ResetTimeOut; begin TimeOut := 0; end; ----------------------------------------------------- procedure TForm1.FormCreate(Sender: TObject); begin timeOut:= 0; end; ------------------------------------------------------ procedure TForm1.Timer1Timer(Sender: TObject); begin inc(TimeOut); if TimeOut = MaxTimeOutValue then begin Timer1.enabled:= false; close; end; end; ------------------------------------------------------------- procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin ResetTimeOut; end;

alguém pode me ajudar... :wink:


Paullsoftware

Paullsoftware

Curtidas 0
POSTAR