Code:function LastInput: DWord; var LInput: TLastInputInfo; begin LInput.cbSize := SizeOf(TLastInputInfo); GetLastInputInfo(LInput); Result := GetTickCount - LInput.dwTime; end; procedure TForm1.Timer1Timer(Sender: TObject); begin Label1.Caption := Format('System has been Idle for %d ms', [LastInput]); end;