function GetIPAddress: string;
var
  CompName: string;
  CompLength: Integer;
  WSAData: TWSAData;
  HostEnt: PHostEnt;
  InAddr: TInAddr;
begin
  Result := '';
  // Get computer name
  CompLength := MAX_COMPUTERNAME_LENGTH;
  SetLength(CompName, CompLength);
  Inc(CompLength);
  GetComputerName(PChar(CompName), CompLength);
  // Initialize WinSock
  if WSAStartup($0101, WSAData) = 0 then
  begin
    // Find host by name
    HostEnt := gethostbyname(PChar(CompName));
    FillChar(InAddr, SizeOf(InAddr), 0);
    if HostEnt <> nil then
    begin
      InAddr.S_un_b.s_b1 := HostEnt^.h_addr^[0];
      InAddr.S_un_b.s_b2 := HostEnt^.h_addr^[1];
      InAddr.S_un_b.s_b3 := HostEnt^.h_addr^[2];
      InAddr.S_un_b.s_b4 := HostEnt^.h_addr^[3];
      Result := StrPas(inet_ntoa(InAddr));
    end;
    // Cleanup WinSock
    WSACleanup;
  end;
end;

Make sure you include WinSock in your uses clause.

---
Yorai Aminov (TeamB)
http://ourworld.compuserve.com/homepages/yaminov

    Source: geocities.com/huanlin_tsai/faq

               ( geocities.com/huanlin_tsai)