function get_UserIP:string;
type
  PPChar = ^PChar;
var
  WSData : TWSAData;
  szHostName : array[0..100] of char;
  pHost : PHostEnt;
  h_addr: PPChar;
  ip : PInAddr;
  ipstr : string;
begin
  if WSAStartup($0101,WSData) = 0 then
  begin
    if gethostname(szHostName, sizeof(szHostName)) = 0 then
    begin
      pHost := gethostbyname(szHostName);
      if pHost <> nil then
      begin
        h_addr := PPChar(pHost^.h_addr_list);
        while (h_addr^ <> nil) do
        begin
          ip := PInAddr(h_addr^);
          ipstr := IntToStr(byte(ip^.S_un_b.s_b1)) + '.' +
                   IntToStr(byte(ip^.S_un_b.s_b2)) + '.' +
                   IntToStr(byte(ip^.S_un_b.s_b3)) + '.' +
                   IntToStr(byte(ip^.S_un_b.s_b4));
          result:=ipstr;
          inc(h_addr);
        end;
      end;
    end;
  end;
end;