Зацените .
Вроде все понятно и просто ..
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdAntiFreezeBase, IdAntiFreeze, IdBaseComponent, IdComponent,
IdRawBase, IdRawClient, IdIcmpClient, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
ListBox1: TListBox;
IdIcmpClient1: TIdIcmpClient;
IdAntiFreeze1: TIdAntiFreeze;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Term:Boolean;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
maxWidth: integer;
CurrentStr: string;
begin
Term:=False;
maxWidth := 50;
CurrentStr:='1';
with ListBox1 do begin
items.Clear;
for i:=1 to 224 do begin
IdIcmpClient1.Host:= '192.168.0.'+IntToStr(i);
IdIcmpClient1.Ping;
if IdIcmpClient1.ReplyStatus.TimeToLive <> 0 then
CurrentStr:=IdIcmpClient1.Host + ' - ok'
else
CurrentStr:=IdIcmpClient1.Host + ' - down';
items.Add(CurrentStr);
Application.ProcessMessages;
if Term then Exit;
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Term:=True;
end;
end.