inet控件循环打开N个url提示"实时错误 35752"
temp.ini内容如下
[网站1]
url=http://www.***.com
[网站2]
url=http://www.***.com
[网站3]
url=http://www.***.com
[网站4]
...........
[网站39]
url=http://www.***.com
有39个字段.
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim strSections() As String, strfile As String, strkk As String
strfile = App.Path & "\temp.ini"
strSections = ReadSections(strfile)
j = 1
For i = 0 To UBound(strSections)
If strSections(i) <> "" Then
Dim Inet As Object
Dim strHTML As String, strTemp As String, strURL As String,
Set Inet = CreateObject("InetCtls.Inet")
Inet.RequestTimeout = 60
Inet.URL = GetIniStr(strSections(i), "url")
strHTML = Inet.OpenURL
strTemp = LCase(strHTML)
debug.print strTemp '这里只有显示到[网址23]那里...就出现实时错误 35752了
endif
Next
End Sub
检查过ini关键字url后的链接,都正确.
[解决办法]
Public Function ReadSections(ByVal FileName As String) As String()
Dim szBuf As String, Length As Integer
Dim SectionArr() As String, m As Integer
szBuf = String$(255, 0)
Length = GetPrivateProfileSectionNames(szBuf, 255, FileName)
szBuf = Left$(szBuf, Length)
SectionArr = Split(szBuf, vbNullChar)
ReadSections = SectionArr
End Function
读配置文件里的字段名.
[解决办法]
实时错误 '35752'
URL is malformed