zu Punkt 4. Deine momentane Internet
IP liest du so aus:
Code:
function GetLocalIPs: String;
type PPInAddr= ^PInAddr;
var wsaData : TWSAData;
HostInfo : PHostEnt;
HostName : Array[0..255] of Char;
Addr : PPInAddr;
begin
if WSAStartup($0102, wsaData) <> 0 then Exit;
try if GetHostName(HostName, SizeOf(HostName)) <> 0 then
begin
result:='';
Exit;
end;
HostInfo:= GetHostByName(HostName);
if HostInfo=nil then
begin
result:='';
Exit;
end;
Addr:=Pointer(HostInfo^.h_addr_list);
if (Addr=nil) or (Addr^=nil) then
begin
result:='';
Exit;
end;
if not (copy(strpas(inet_ntoa(addr^^)),1,7) = '192.168') then
begin
result:=StrPas(inet_ntoa(Addr^^));
inc(Addr);
end
else
begin
inc(addr);
while Addr^ <> nil do
begin
result:=StrPas(inet_ntoa(Addr^^));
inc(Addr);
end;
end;
finally WSACleanup;
end;
end;
Mfg Salomon