Results 1 to 11 of 11

Thread: How to get current ip address with VB 6.0

  1. #1
    Join Date
    May 2009
    Posts
    210

    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 ?

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    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.

  3. #3
    Join Date
    Jan 2008
    Posts
    1,521

    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.

  4. #4
    Join Date
    May 2009
    Posts
    210

    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 !!

  5. #5
    Join Date
    Oct 2009
    Posts
    1

    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?

  6. #6
    Join Date
    Jul 2011
    Posts
    3

    Re: How to get current ip address with VB 6.0

    hi, where is the attachment?

  7. #7
    Join Date
    Jan 2006
    Posts
    605

    Re: How to get current ip address with VB 6.0

    Quote Originally Posted by shankardhekal View Post
    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

  8. #8
    Join Date
    Jul 2011
    Posts
    3

    Re: How to get current ip address with VB 6.0

    Quote Originally Posted by janos™ View Post
    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.

  9. #9
    Join Date
    Dec 2007
    Posts
    2,288

    Re: How to get current ip address with VB 6.0

    Quote Originally Posted by shankardhekal View Post
    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.

  10. #10
    Join Date
    Jul 2011
    Posts
    3

    Re: How to get current ip address with VB 6.0

    Quote Originally Posted by einstein_007 View Post
    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 .

  11. #11
    Join Date
    Mar 2010
    Posts
    235

    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.

Similar Threads

  1. Track IP Address and Current Location of Orkut User
    By ChrisUlrich in forum Tips & Tweaks
    Replies: 3
    Last Post: 09-02-2011, 12:09 PM
  2. Specific IP address changing TCP IPv4 DNS server address
    By Poks in forum Networking & Security
    Replies: 4
    Last Post: 11-01-2011, 06:05 AM
  3. Bypass Export address table Address Filter (EAF)
    By Dwarner in forum Software Development
    Replies: 4
    Last Post: 25-12-2010, 08:06 AM
  4. Replies: 2
    Last Post: 16-02-2009, 08:06 PM
  5. Adding new email address to exchange address book
    By RaeS in forum Small Business Server
    Replies: 5
    Last Post: 23-09-2008, 08:24 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,752,123,433.48108 seconds with 16 queries