Funcion para saber la ip pública. Necesita las unidades IdHTTP y WinInet.
Codigo recogido en el Foro.
Código Delphi
[-]
function IP_Publica:string;
function IsNumeric( T:string ):boolean;
begin
Result:=false;
if (length(T)>0) then
case T[1] of
'0'..'9':Result:=true;
end;
end;
var
HTMLBody:string;
i:integer;
IdHTTP:TIdHTTP;
begin
Result:='';
if WinInet.InternetGetConnectedState(nil,0)
then begin
IdHTTP:=TIdHTTP.Create(Application);
try
HTMLBody:=IdHTTP.Get('http://checkip.dyndns.org/');
for i:=0 to Length(HTMLBody)-1 do begin
if IsNumeric(HTMLBody[i])
or (HTMLBody[i]='.')
then Result:=Result+HTMLBody[i];
end;
finally
IdHTTP.Free;
end;
end;
end;