一个VB的编程问题

来源:百度知道 编辑:UC知道 时间:2024/07/04 13:01:17
Dim一个String变量dl,然后获取网络上地址为“http://www.xxxx.com/xxxx.txt"的文本文件中的文本内容,如:
xxxxx
然后将这些文本内容赋予变量dl

要建一个intel控件
Dim xx As String, yy As String, url As String
Dim t As Double
url = "http://www.xxxx.com/xxxx.txt"
Inet1.Cancel
Inet1.Execute url, "get"

t = Timer
Do
DoEvents
If Inet1.StillExecuting = False Or Abs(t - Timer) > 20 Then Exit Do
Loop
xx = ""
Do
DoEvents
yy = Inet1.GetChunk(32768)
If yy = "" Or Abs(t - Timer) > 20 Then Exit Do
xx = xx & Uf8ToUf(yy) ‘为了解决中文乱码问题的函数
dl = xx
Loop

Public Function Uf8ToUf(strUf8 As String) As String
'将UF8转为VB内部处理编码UF
'
'
On Error GoTo MyErr
Dim lngStrLen As Long '需转换的字符串长度
Dim byUf8() As Byte '保存源字符串
Dim byUf(1) As Byte '字符串暂存1
Dim strDef As String '字符串暂存