uses WinSock;
function GetLocalIPAddress : string;
var wsdata : TWSAData;
he : PHostEnt;
ss : pchar;
ip : TInAddr;
i : cardinal;
co : string;
begin
i := MAX_COMPUTERNAME_LENGTH + 1;
SetLength(co,i);
GetComputerName(PChar(co),i);
WSAStartup(MakeWord(1, 1), wsdata);
he := gethostbyname(pchar(co));
if he<>nil then begin
ip.S_addr := integer(pointer(he^. h_addr_list^)^);
ss := inet_ntoa(ip);
Result := string(ss);
end;
WSACleanup();
end;
Jeppe Johansen
Jeppesoftware@hotmail.com
[Redigeret d. 28/08-04 13:53:41 af Jeppe]
Det skal være på en måde så det er muligt at ligge det i en const fra starten af.
Mvh.
Rune Jensen
---------------------------------------------------------------------------
##The one who laugh last is the one who think slowest!##
---------------------------------------------------------------------------