Delphi - GetLastInputInfo

function SecondsIdle: DWord;
var
   liInfo: TLastInputInfo;
begin
   liInfo.cbSize := SizeOf(TLastInputInfo) ;
   GetLastInputInfo(liInfo) ;
   Result := (GetTickCount - liInfo.dwTime) DIV 1000;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Label1.Caption := Format('System IDLE last %d seconds', [SecondsIdle]) ;
end;

2012-01-26T23:14:39 +0100, mail[at]michael[Bindestrich]puff.de