Hola shoulder.
Cita:
Empezado por shoulder
...habia puesto cada 7200 segundos que cierre el programa (2 horas de inactividad), con un Timer 1000. pero no me hace caso...
|
Fijate si de este modo hace lo que buscas:
Código Delphi
[-]
...
implementation
const
DOS_HORAS = 2 * 3600 * 1000;
procedure TForm1.FormCreate(Sender: TObject);
begin
with Timer1 do
begin
Interval:= 1000;
Enabled := True;
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
LastInputInfo: TLastInputInfo;
begin
ZeroMemory(@LastInputInfo, SizeOf(LastInputInfo));
LastInputInfo.cbSize:= SizeOf(TLastInputInfo);
Win32Check(GetLastInputInfo(LastInputInfo));
if GetTickCount - LastInputInfo.dwTime >= DOS_HORAS then
begin
Timer1.Enabled:= False;
MessageBox(0,'La aplicación estuvo 2 horas inactiva y se cerrará', '', MB_OK);
Application.Terminate;
end;
end;
Saludos