var
computerName : Pchar;
Name : String;
size : Cardinal;
Host : PHostent;
WSDATA : Twsadata;Begin
Getwindowrect(Search_ip.handle,r);
break_b:=false;
Size:=255;
GetMem(ComputerName,size);
GetComputerName(ComputerName,Size);
Name:=String(ComputerName);
WSASTARTUP(2,WSDATA);
host:=gethostbyname(computername);
if host<>nil then
ip1.text:=inttostr(ord(host.h_addr^[0]));
ip5.caption:=ip1.text;
ip2.text:=inttostr(ord(host.h_addr^[1]));
ip6.caption:=ip2.text;
ip3.text:=inttostr(ord(host.h_addr^[2]));
ip7.caption:=ip3.text;
ip4.text:='1';
ip8.text:='255'; FreeMem(ComputerName);
WSACLEANUP;
end;
得到本级的IP
可以加如到数据库
OK了
computerName : Pchar;
Name : String;
size : Cardinal;
Host : PHostent;
WSDATA : Twsadata;Begin
Getwindowrect(Search_ip.handle,r);
break_b:=false;
Size:=255;
GetMem(ComputerName,size);
GetComputerName(ComputerName,Size);
Name:=String(ComputerName);
WSASTARTUP(2,WSDATA);
host:=gethostbyname(computername);
if host<>nil then
ip1.text:=inttostr(ord(host.h_addr^[0]));
ip5.caption:=ip1.text;
ip2.text:=inttostr(ord(host.h_addr^[1]));
ip6.caption:=ip2.text;
ip3.text:=inttostr(ord(host.h_addr^[2]));
ip7.caption:=ip3.text;
ip4.text:='1';
ip8.text:='255'; FreeMem(ComputerName);
WSACLEANUP;
end;
得到本级的IP
可以加如到数据库
OK了
const char FAR * name );