uses winsock
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;function GetTheComputerName: string;
var
ComputerName: array [0..MAX_COMPUTERNAME_LENGTH] of Char;
nSize: DWORD;
begin
nSize := MAX_COMPUTERNAME_LENGTH;
FillChar(ComputerName, MAX_COMPUTERNAME_LENGTH, 0);
GetComputerName(ComputerName, nSize);
Result := ComputerName
end;
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;function GetTheComputerName: string;
var
ComputerName: array [0..MAX_COMPUTERNAME_LENGTH] of Char;
nSize: DWORD;
begin
nSize := MAX_COMPUTERNAME_LENGTH;
FillChar(ComputerName, MAX_COMPUTERNAME_LENGTH, 0);
GetComputerName(ComputerName, nSize);
Result := ComputerName
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货