我改他人的函数Show一下咯:调试能过了的!!!希望对你有帮助,呵呵~~~~~~~~~~~~
uses {...,}Winsock;
procedure ShowHostIP(HostName: WideString);
var
wVersionRequested : WORD;
wsaData : TWSAData;
p : PHostEnt;
s : String;
p2 : pchar;
begin
wVersionRequested := MAKEWORD(1, 1);
WSAStartup(wVersionRequested, wsaData);
S:= HostName;
p := GetHostByName(PChar(s));
ShowMessage(Format('Computer name is ''%s''.', [p^.h_Name]));
p2 := iNet_ntoa(PInAddr(p^.h_addr_list^)^);
ShowMessage(Format('IP address is %s.',[p2]));
WSACleanup;
end;