Xixi, you can use Winsocket function:
gethostname,, to get your machine name
then gethostbyname, pass your hostname to it,
you can get all ip address from the result of this function. (If
you have many netcard, or be a multihome machine
like NT)
取得本地计算机的名字:
Windows 95 API: GetComputerName
题外话:取得本地登录用户名:GetUserName
取得本地ip地址(转贴):
function LocalIP : 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 := '';
GetHostName(Buffer, SizeOf(Buffer));
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;