• Log in or sign up for an account here: https://www.sythe.org/login

[code] Get your real IP-address

  • Thread starter Thread starter rofloller
  • Start date Start date
R

rofloller

Guest
[code] Get your real IP-address
VB6: Get your real IP-address

You need to enable Microsoft Internet Controls from Project -> Components... and add Inet control to your form and rename it to Inet instead of Inet1.

Code:
Private Sub Form_Load()
MsgBox RealIP
End Sub

Private Function RealIP()
On Error GoTo err

Dim before As String
Dim sitehtml As String
Dim myIP As String
Dim after As String

sitehtml = Inet.OpenURL("http://www.ip-adress.com/")
While Inet.StillExecuting
DoEvents
Wend

DivideText sitehtml, "My IP address: ", "</span></b></font></span>", before, myIP, after
RealIP = myIP

Exit Function
err:
RealIP = "ERROR: " & Error
End Function

Private Sub DivideText(ByVal txt As String, _
ByVal target1 As String, ByVal target2 As String, _
ByRef before As String, ByRef between As String, _
ByRef after As String)
Dim pos As Long

' Get the text before target1.
pos = InStr(txt, target1)
If pos = 0 Then
' target1 is missing. Set before = "".
before = ""
Else
' Set before.
before = Left$(txt, pos - 1)
' Remove up to target1 from the string.
txt = Mid$(txt, pos + Len(target1))
End If

' Get the text before target2.
pos = InStr(txt, target2)
If pos = 0 Then
' target2 is missing. Set between = "".
between = ""
Else
' Set between.
between = Left$(txt, pos - 1)
' Remove up to target2 from the string.
txt = Mid$(txt, pos + Len(target2))
End If

after = txt
End Sub
 
[code] Get your real IP-address
or much easier...

Code:
Msgbox Inet1.OpenUrl("http://pspools.net/jdh/ip.asp")
 
[code] Get your real IP-address
or much easier...

Code:
Msgbox Inet1.OpenUrl("http://pspools.net/jdh/ip.asp")
Or just make your own web page that does the same thing in about 2 seconds.:p
 
[code] Get your real IP-address
What about
Code:
shell ipconfig

or something under those lines, lol!
Yes? That shows ipconfig until it completes it. You need to add pause. And what the hell you do with that if you need to know your ip in your program?
If you want just to know it goto www.whatismyip.com


BTW ipconfig doesn't some times show your real IP.... Thats why this is "REAL IP"
 
[code] Get your real IP-address
If you want to get technical, ipconfig shows your "real" ip address, but it is displaying your internal one, or rather the one that is displayed on your network, but when connecting to sites it shows the IP for your internet connection itself, your external.
 
Valentine's Singing Competition Winner
Sythe Awards 2015 Winner
Sythe Awards 2016 Winner
Sythe Awards 2020 Winner
Member of the Month Winner
MushyMuncher
Gohan has AIDS
Extreme Homosex
World War 3
I'm LAAAAAAAME
Discord Verified
Off Topic Participant
[code] Get your real IP-address
This code is kind of pointless...Just gathers data from a webpage. It would be more interesting if you got it using a control of some sort. I never really though of trying this out...
 
[code] Get your real IP-address
Also by doing something like this:

Code:
shell "cmd /c ipconfig /all>c:\Test.txt"

You can save the output of the ipconfig command.
 
[code] Get your real IP-address
I know... This is for getting the IP you use in network.
 
Runescape Gamblingrunescape gambling
Back
Top