Código
function EstaVivo(IP: String): boolean;
e na seção Implements:
function TForm1.EstaVivo(IP: String): boolean;
begin
with Pingador do begin
Host := IP;
ReceiveTimeout := 500;
Ping;
if ReplyStatus.BytesReceived > 0 then
result := true
else
result := false;
end;
end;
Exemplo de como usar:
procedure TForm1.Button1Click(Sender: TObject);
begin
if EstaVivo2(Edit1.Text) then
ShowMessage('Vivo')
else
ShowMessage('Morto');
end;
Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009