Page 1 of 1

PC IP Address

Posted: Fri Oct 27, 2006 10:56 pm
by Jeff Barnes
Hi Everybody,

I'm trying to have my program store the end users internal IP Address but I can not seem to get the actual address.

I am using:

GetHostByName( GetHostName() )

But it always returns 0.0.0.0

What am I doing wrong?

Thanks,
Jeff

Posted: Sat Oct 28, 2006 2:34 am
by James Bott
Jeff,

You must add WsaStartup() before the call to Gethostbyname() and add a WsaCleanup() after the call.

Try this:

Function GetIP()
Local cVar1
WsaStartUp()
cVar1 := GetHostByName( GetHostName() )
WsaCleanUp()
return cVar1

James

Posted: Sun Oct 29, 2006 2:27 pm
by Jeff Barnes
Thanks James.

Works perfectly.


Jeff