Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting User's IP Address. 1

Status
Not open for further replies.

Ed2020

Programmer
Nov 12, 2001
1,899
GB
Hi,

I'm looking for some code to return the user's IP address.

I've searched high and low but can't find any way of doing it.

Anybody got any ideas?

Ed Metcalfe.
ed_metcalfe@hotmail.com
 
Place a Winsock control on your form (it will be hidden at runtime so it does not matter where you put it)and set it's name to Winsock1.

With this on your form you can now get the IP address by using the following code:

MyIPAddress = Winsock1.LocalIp


Do what you will then with the variable MyIPAddress.

HTH

Jamie Gillespie
j-gillespie@s-cheshire.ac.uk
 
Thanks Jamie. Have a purple star!

Does anybody know a way of doing it without having a specific form open with a WinSock control on it?

Ed Metcalfe
ed_metcalfe@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top