function GetIpAddress: string;
var
wVersionRequested: WORD;
wsaData: TWSAData;
p: PHostEnt;
s: array[0..128] of Char;
begin
wVersionRequested := MAKEWORD(1, 1);
WSAStartup(wVersionRequested, wsaData);
try
GetHostName(@s, 128);
p := GetHostByName(@s);
{Get the IpAddress}
Result := StrPas(iNet_ntoa(PInAddr(p^.h_addr_list^)^));
finally
WSACleanup
end
end;
var
wVersionRequested: WORD;
wsaData: TWSAData;
p: PHostEnt;
s: array[0..128] of Char;
begin
wVersionRequested := MAKEWORD(1, 1);
WSAStartup(wVersionRequested, wsaData);
try
GetHostName(@s, 128);
p := GetHostByName(@s);
{Get the IpAddress}
Result := StrPas(iNet_ntoa(PInAddr(p^.h_addr_list^)^));
finally
WSACleanup
end
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货