展开全部
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
Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function
Public Function StrIp()
Dim l As String
Dim I As Integer
Dim K1 As Integer, K2 As Integer
DownloadFile "http://www.ip138.com/ip2city.asp", "C:\tmp.txt" '下载文件
Open "C:\tmp.txt" For Input As #1 '读取文件
Do Until EOF(1)
Line Input #1, l '一行一行读取
For I = 1 To Len(l)
If Mid(l, I, 1) = "[" Then
K1 = I + 1
K2 = InStr(l, "]")
StrIp = Mid(l, K1, K2 - K1)
GoTo Js
End If
Next I
Loop
Js:
Close #1
Kill "C:\tmp.txt" '删除临时文件
End Function
Private Sub Form_Load()
Me.Show
Print StrIp
End Sub
Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function
Public Function StrIp()
Dim l As String
Dim I As Integer
Dim K1 As Integer, K2 As Integer
DownloadFile "http://www.ip138.com/ip2city.asp", "C:\tmp.txt" '下载文件
Open "C:\tmp.txt" For Input As #1 '读取文件
Do Until EOF(1)
Line Input #1, l '一行一行读取
For I = 1 To Len(l)
If Mid(l, I, 1) = "[" Then
K1 = I + 1
K2 = InStr(l, "]")
StrIp = Mid(l, K1, K2 - K1)
GoTo Js
End If
Next I
Loop
Js:
Close #1
Kill "C:\tmp.txt" '删除临时文件
End Function
Private Sub Form_Load()
Me.Show
Print StrIp
End Sub
Storm代理
2023-07-25 广告
2023-07-25 广告
StormProxies是一家提供动态代理服务器服务的企业,旨在帮助用户更好地管理网络访问和安全。以下是一些关于StormProxies的IP动态代理服务的特点:1. 高匿名性:StormProxies的动态代理服务器具有高匿名性,可以有效...
点击进入详情页
本回答由Storm代理提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询