Yip heres the code I use....I ended up creating a COM Dll that I just call
from anywhere and from anything to optain the IP of a machine. beware tho,
if you are dialed into the net, it will return your Dialup's IP address :--
uses
winsock;
function ReturnLocalIP : 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^[I] <> nil do begin
result:=StrPas(inet_ntoa(pptr^[I]^));
Inc(I);
end;
WSACleanup;
end;
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Peter Hyde
> Sent: Friday, October 15, 1999 9:07 PM
> To: Multiple recipients of list offtopic
> Subject: [DUG-OFFTOPIC]: obtaining IP #
>
>
> Hi folks,
> No doubt there's a component for this on the DSP but, in case
> there's a simpler way:
>
> Does anyone have reasonably quick-'n-dirty code handy for
> obtaining the (i.e. any one of the possible) IP number(s) for the
> current machine?
>
> Thanks.
>
> cheers,
> peter
>
> ============================================
> Peter Hyde, SPIS Ltd, Christchurch, New Zealand
> * Web automation for online periodicals: http://TurboPress.com
> * TCompress/TCompLHA compression components for Delphi/C++
> * TurboNote: http://TurboPress.com/tbnote.htm
> -- small, FREE and very handy
> Find all the above and MORE at http://www.spis.co.nz
> ------------------------------------------------------------------
> ---------
> New Zealand Delphi Users group - Offtopic List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
>
---------------------------------------------------------------------------
New Zealand Delphi Users group - Offtopic List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz