|
-
Aug 25th, 2000, 04:41 AM
#1
Thread Starter
Frenzied Member
I'm having problems retrieving my CORRECT IP address!
I place a WinSock control in my form, and wites the following code:
Code:
Private Sub Form_Load()
MsgBox Winsock1.LocalIP
End Sub
Now it should return my static IP 1.0.0.1, but it returns 246.132.155.221 and my
computer name is 'cybercarsten', but it returns my username for my Internet Connection!!!
What is wrong here!!!!????
-
Aug 25th, 2000, 04:45 AM
#2
Thread Starter
Frenzied Member
No need to reply guys! : o )
I found out that, it was he installer cd from my ISP that made a registry error, and changed my hostname and IP!
-
Aug 25th, 2000, 08:39 AM
#3
Fanatic Member
i'm sure there is a better way, but what I did way batch the command route print and get all the addresses local to the machine.
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal opOperation As String, ByVal lpFile As String, ByVal opParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Sub ShellExe(What As String)
On Error Resume Next
Call ShellExecute(0&, vbNullString, What, vbNullString, vbNullString, vbNormalFocus)
End Sub
Private Sub Command1_Click()
Dim InD As String
Dim a As Integer
Dim b As Integer
Dim m1
Dim m2
Open "c:\temp.bat" For Output As 1
Print #1, "route print > c:\temp.txt"
Close #1
Shell "c:\temp.bat", vbMinimizedFocus
t = Timer
Do Until Val(t) + 1 < Timer
Loop
Open "c:\temp.txt" For Input As #1
InD = Input(LOF(1), 1)
Close #1
m1 = Split(InD, vbCrLf)
b = 1
Do Until InStr(m1(b), "Metric") <> 0 Or b > 15
b = b + 1
Loop
b = b + 1
For a = b To UBound(m1)
If InStr(m1(a), "=====") Then
a = UBound(m1)
Else
Debug.Print Trim(Mid(m1(a), 53, 16))
End If
Next a
End Sub
Kurt Simons
[I know I'm a hack but my clients don't!]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|