function GetInputAwayTime():DWORD; var lpi:TLastInputInfo; begin lpi.cbSize := sizeof(lpi); GetLastInputInfo(lpi); Result := Round((GetTickCount()-lpi.dwTime)/1000); end; procedure TForm1.Timer1Timer(Sender: TObject); begin Caption := IntToStr(GetInputAwayTime) end;