发布网友 发布时间:2024-10-24 12:13
共1个回答
热心网友 时间:2024-11-07 18:37
可以。 { 首先,添加部件(控件)“Microsoft Internet Transfer Control 6.0”。 然后在窗体中加入“Inet”(名称为"Inet1) } __以下是提取网页源代码过程及写入文件过程 { Private Sub Inet1_StateChanged(ByVal State As Integer) Dim blnOK As Boolean Dim varTemp As Variant Dim Strdata As String blnOK = False Select Case State Case icError '错误发生 MsgBox "发生错误: " & Inet1.ResponseCode & "# " & Inet1.ResponseInfo, vbCritical Case icResponseCompleted '传送数据完成 '以 GetChunk 获取来自 StateChanged 之资料 varTemp = Inet1.GetChunk(1024) DoEvents Do While Not blnOK Strdata = Strdata & varTemp varTemp = Inet1.GetChunk(1024) DoEvents If Len(varTemp) = 0 Then blnOK = True End If Loop 将取得的原代码写到文件:app.path\receive.html Open "app.path\receive.html" For Output As #1 Print #1, Strdata Close #1 End Select End Sub } __以下是调用过程 { Inet1.Execute "网址", "GET" }