没问题,其实IE本身也是不能区分IP和计算机名的。你输入一个IP,他首先找IP,然后就找地址了。
如www.169.169.169.169.net什么的。
uses
WinSock;
function GetIPByName(AName: string): string;
type
TaPInAddr = array[0..10] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
phe: PHostEnt;
pptr: PaPInAddr;
Buffer: array[0..63] of char;
I: Integer;
GInitData: TWSADATA;
begin
WSAStartup($101, GInitData);
Result := '';
StrPCopy(Buffer, AName);
phe := GetHostByName(buffer);
if phe = nil then Exit;
pptr := PaPInAddr(Phe^.h_addr_list);
I := 0;
while pptr^ <> nil do
begin
Result := StrPas(inet_ntoa(pptr^^));
Inc(I);
end;
WSACleanup;
end;