Einzelnen Beitrag anzeigen

Benutzerbild von Gollum
Gollum

Registriert seit: 14. Jan 2003
Ort: Boxberg
456 Beiträge
 
Delphi 10.1 Berlin Professional
 
#4

Re: Ping ausführen und bei Erfolg Farbe ändern

  Alt 22. Mär 2005, 20:11
Hallo,

etwa so?

Delphi-Quellcode:
procedure TForm1.IdIcmpClient1Reply(ASender: TComponent;
  const AReplyStatus: TReplyStatus);
var sTime: string;
begin
  if (IdIcmpClient1.ReplyStatus.MsRoundTripTime = 0) then sTime:='<1else sTime:='=';
  Label1.Caption:=Format('%d Byte von %s: icmp_seq=%d ttl=%d Zeit%s%dms',
                [IdIcmpClient1.ReplyStatus.BytesReceived, IdIcmpClient1.ReplyStatus.FromIpAddress, IdIcmpClient1.ReplyStatus.SequenceId, IdIcmpClient1.ReplyStatus.TimeToLive, sTime, IdIcmpClient1.ReplyStatus.MsRoundTripTime])+#9;
  if (IdIcmpClient1.ReplyStatus.BytesReceived>0) then Label1.Font.Color:=clGreen
    else Label1.Font.Color:=clRed;
end;
  Mit Zitat antworten Zitat