VB6 IP Problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 12 of 12

Thread: VB6 IP Problem

  1. #1
    Join Date
    Sep 2004
    Posts
    9

    VB6 IP Problem

    Hey guys,,

    I have a little problem. I'm writing an App in VB6.
    In this app, I need the program to find out the internet IP of the pc it's running on.

    I have no clue how to do this, im pretty advanced in VB6, and ive googled for an hour but cant find anything.


    Plz help me out?

    Thanks in advance,
    zephy
    "If the world wouldn't suck, We'd all fall off!"

  2. #2
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    you should depend on a third party web page or like that, because the internet ip is only known by the router or any server that accept incoming request from this router, so the sequence will be : the webpage recive the ip, you download the webpage and parse it to get the ip.
    for dial-up it's vey easy as you may know ... it's exactly like getting the local ip for lan network.
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  3. #3
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819

  4. #4
    Join Date
    Sep 2004
    Posts
    9
    Quote Originally Posted by Amahdy

    404 file not found, Thats what im looking for though

    HELP?
    Last edited by BlackOut; 11-27-2007 at 07:07 PM.
    "If the world wouldn't suck, We'd all fall off!"

  5. #5
    Join Date
    Aug 2005
    Location
    Hermosillo, Sonora, Mexico
    Posts
    103
    Maybe this attachment helps you
    Attached Files Attached Files

  6. #6
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Just put a Winsock control on your form and do
    Code:
    Text1.Text = Winsock1.LocalIP
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  7. #7
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    **Hack I didin't know you, I think it's a new member here lol

    well BlackOut I'm afraid but the page opens here so try again maybe the server was down yesterday..
    jggtz : what about sharing the source code ?
    Hack : winsock can't help because it will return the local network IP not the internet IP, actually the PC can't know byitself it's internet IP, but the router do, so we need just interact with the router or any webserver to get the IP, doing that from a webpage maybe be a valid solution.
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  8. #8
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Quote Originally Posted by BlackOut
    IP of the pc it's running on.
    This to me says local IP.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  9. #9
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    before IP there is internet :
    ...internet IP of the pc ...
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  10. #10
    Join Date
    Aug 2005
    Location
    Hermosillo, Sonora, Mexico
    Posts
    103
    Another one :
    To get IP Address for the router that you're behind
    I found over internet and I haven't tested yet

    Option Explicit
    ' Add Microsoft Internet Transfer Control

    Dim pubIPA As String, pos1 As Long, pos2 As Long, str As String

    Private Sub Form_Load()
    str = Inet1.OpenURL("http://vbnet.mvps.org/resources/tools/getpublicip.shtml", icString)
    pos1 = InStr(str, "var ip =")
    pos1 = InStr(pos1 + 1, str, "'", vbTextCompare) + 1
    pos2 = InStr(pos1 + 1, str, "'", vbTextCompare)
    pubIPA = Mid$(str, pos1, pos2 - pos1)
    MsgBox pubIPA, vbInformation
    Unload Me
    End Sub

  11. #11
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    Yes this is the another solution of depending on a third-party webpage, like the one used here :
    "http://vbnet.mvps.org/resources/tools/getpublicip.shtml"

    just open it in your browser it should diplay your IP somehow, use the inet to download it then parse it and extract the ip from it...
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  12. #12
    Join Date
    Apr 2009
    Posts
    1

    Smile I have what u want

    I have exactly what u want

    http://www.vbforums.com/showthread.php?t=469768

    This works exelent

    I hope it helps u...
    Attached Files Attached Files
    Last edited by Sabotaz; 04-01-2009 at 12:27 PM.

Similar Threads

  1. VB6 Print Problem
    By Probie in forum VB Classic
    Replies: 3
    Last Post: 01-05-2007, 03:37 PM
  2. login problem
    By dbrook007 in forum ASP.NET
    Replies: 0
    Last Post: 11-06-2006, 04:54 AM
  3. ActiveX problem using VB
    By koraal in forum VB Classic
    Replies: 3
    Last Post: 11-03-2006, 03:50 PM
  4. vb6 client/server problem
    By Algorien in forum VB Classic
    Replies: 8
    Last Post: 10-11-2006, 09:12 AM
  5. Replies: 2
    Last Post: 08-10-2000, 10:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center