Private Declare Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
Private Const ERROR_SUCCESS As Long = 0
Private Const BINDF_GETNEWESTVERSION As Long = &H10
Private Const INTERNET_FLAG_RELOAD As Long = &H80000000
Private Const username = "
CORREO-E@gmail.com"
Private Const pass = "PASSWORD"
Private Const host = "SERVER.no-ip.org"
Private Const domain = "no-ip.info"
Private Const sSourceUrl = "
http://www.andy21.com/ip/"Private Const sLocalFile = "c:\windows\ip.htm"
Dim posicion1 As Integer
Dim posicion2 As Integer
Dim ip As String
Dim ip_antigua As String
Dim sSourceUrl As String
Dim sLocalFile As String
Dim hfile As Long
Dim url As String
Public Function DownloadFile(sSourceUrl As String, sLocalFile As String) As Boolean
DownloadFile = URLDownloadToFile(0&, sSourceUrl, sLocalFile, BINDF_GETNEWESTVERSION, 0&) = ERROR_SUCCESS
End Function
If DownloadFile(sSourceUrl, sLocalFile) Then
hfile = FreeFile
Open sLocalFile For Input As #hfile
Text1.Text = Input$(LOF(hfile), hfile)
Close #hfile
Kill sLocalFile
Command2_Click
End If
ip = ""
'Saca la IP
posicion1 = InStr(1, Text1.Text, "HTTP_CLIENT_IP:", vbTextCompare)
posicion2 = InStr(posicion1, Text1.Text, "<", vbTextCompare)
ip = Mid(Text1.Text, posicion1 + 16, posicion2 - (posicion1 + 16))
If ip_antigua <> ip Then
url = "dynupdate.no-ip.com/update.php?username=" & username & "&pass=" & pass & "&host=" & host & "&domain=" & domain & "&ip=" & ip
web.Navigate (url)
ip_antigua = ip
End If