How to get current ip address with VB 6.0
I want to use a emailing macro I made in VB6 to email myself my new IP address everytime it changes. Since I have a dsl conneciton, the ip changes often.when i try getting my ip using winsock and other things i get other ip which is wrong.
Could you guys make me know how can i get IP address with VB 6 ?
Re: How to get current ip address with VB 6.0
Finding IP address n VB 6 with winsock control (Winsock1.LocalIP) is the best and easiest way.Place a Winsock Control in your Form( Project -> Components -> Microsoft WinSock Control ) and use MsgBox Winsock1.LocalIP to retrieve the Local IP name. I dont think it gives wrong address but in case its like that than go to whatismyip.com,, it will give your Ip address.
Re: How to get current ip address with VB 6.0
To get current ip address with VB 6.0 you can also try Windows Sockets.returns the standard host name for the local machine.. try this :-
- Start a new project in Visual Basic. Form1 is created by default.
- Place a CommandButton, Command1, on Form1.
- Place the Attachment code in the General Declarations section of Form1
- NowPress the F5 key to run the project.
- Click Command1 to obtain the host information.
Re: How to get current ip address with VB 6.0
Thanks for this useful solution friends. I really needed this. I tried many thing but won't able to get the correct ip, hope this will work for me.
Thank you !!
Re: How to get current ip address with VB 6.0
I have the same problem,
I tried this code but the only I get is my ip in my local network. Can you advise me how can I get the IP I have with Internet connection?
Re: How to get current ip address with VB 6.0
hi, where is the attachment?
Re: How to get current ip address with VB 6.0
Quote:
Originally Posted by
shankardhekal
hi, where is the attachment?
Which attachment are you talking about, in any case, use the winsock control and then use this to find the local ip...
winsock1.localip
Re: How to get current ip address with VB 6.0
Quote:
Originally Posted by
janos™
Which attachment are you talking about, in any case, use the winsock control and then use this to find the local ip...
winsock1.localip
I want to get the internet IP address , not the local IP address.
Re: How to get current ip address with VB 6.0
Quote:
Originally Posted by
shankardhekal
I want to get the internet IP address , not the local IP address.
You can get this ip address for static IP by just adding Microsoft Winsock Control 6.0 [i]MSWINSCK.ocx into component and use this code:
Code:
Private Sub Command1_Click()
MsgBox Winsock1.LocalIP
End Sub
And if you don't want to use Winsock. You can try your hands on GetIpAddrTable API.
Re: How to get current ip address with VB 6.0
Quote:
Originally Posted by
einstein_007
You can get this ip address for static IP by just adding Microsoft Winsock Control 6.0 [i]MSWINSCK.ocx into component and use this code:
Code:
Private Sub Command1_Click()
MsgBox Winsock1.LocalIP
End Sub
And if you don't want to use Winsock. You can try your hands on GetIpAddrTable API.
I dont want LOCAL IP. I want GLOBAL IP address .
Re: How to get current ip address with VB 6.0
Hello I am not aware of this thing but still as per my knowledge you have to use some script for it. Try to find about this on internet there you will get. Actually I tried to find about it but it is related to the local ip address scripts but not related with global. So you make an effort to find about it on internet. I am sure you will get in on net. And if you find any other code or solutions for it then share it with us.