WEBBROWSER控件怎样设置为不加载图片?
修改注册表会影响IE,VB用WININET会线程堵塞。有没有办法不让WEBBROWSER不加载图片?或有没有只下载源代码的网页控件或方法?1楼的,您能补充把c:\baid...
修改注册表会影响IE,VB用WININET会线程堵塞。有没有办法不让WEBBROWSER不加载图片?或有没有只下载源代码的网页控件或方法?
1楼的,您能补充把c:\baidu.com的源代码复制到text1的代码吗,如果可以我给多10分 展开
1楼的,您能补充把c:\baidu.com的源代码复制到text1的代码吗,如果可以我给多10分 展开
1个回答
展开全部
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 Sub Command1_Click()
Dim F As String, nURL As String, S As Long
nURL = "http://www.baidu.com/"
F = "C:\baidu.htm"
S = URLDownloadToFile(0, nURL, F, 0, 0) '下载网页源文件,返回 0 表示成功
End Sub
补充:------------------------------
'控件: Command1、text1
'在属性窗口设置 text1 属性:MultiLine = True ScrollBars = 2
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 Sub Command1_Click()
Dim F As String, nURL As String, S As Long, nStr As String
nURL = "http://www.baidu.com/"
F = "C:\baidu.htm"
S = URLDownloadToFile(0, nURL, F, 0, 0) '下载网页源文件,返回 0 表示成功
If ReadSaveF(nStr, F) Then Text1.Text = nStr
End Sub
Private Function ReadSaveF(nStr As String, F As String, Optional IsSave As Boolean) As Boolean
'读写文件,IsSave=True 为写,否则为读
Dim H As Long, B() As Byte, S As String
H = FreeFile
On Error GoTo Exit1
If IsSave Then '将变量 nStr 保存到文件
If Dir(F, 7) <> "" Then SetAttr F, 0: Kill F '删除原来的文件
Open F For Binary As #H '用二进制方式打开一个文件
Put #H, , nStr
Close #H
Else '将文件内容读入变量 nStr
S = FileLen(F)
ReDim B(1 To S)
Open F For Binary As #H '用二进制方式打开一个文件
Get #H, , B
Close #H
nStr = StrConv(B, vbUnicode) '字符串转变为 vbUnicode 字符
End If
ReadSaveF = True
Exit Function
Exit1:
Close #H
End Function
Private Sub Command1_Click()
Dim F As String, nURL As String, S As Long
nURL = "http://www.baidu.com/"
F = "C:\baidu.htm"
S = URLDownloadToFile(0, nURL, F, 0, 0) '下载网页源文件,返回 0 表示成功
End Sub
补充:------------------------------
'控件: Command1、text1
'在属性窗口设置 text1 属性:MultiLine = True ScrollBars = 2
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 Sub Command1_Click()
Dim F As String, nURL As String, S As Long, nStr As String
nURL = "http://www.baidu.com/"
F = "C:\baidu.htm"
S = URLDownloadToFile(0, nURL, F, 0, 0) '下载网页源文件,返回 0 表示成功
If ReadSaveF(nStr, F) Then Text1.Text = nStr
End Sub
Private Function ReadSaveF(nStr As String, F As String, Optional IsSave As Boolean) As Boolean
'读写文件,IsSave=True 为写,否则为读
Dim H As Long, B() As Byte, S As String
H = FreeFile
On Error GoTo Exit1
If IsSave Then '将变量 nStr 保存到文件
If Dir(F, 7) <> "" Then SetAttr F, 0: Kill F '删除原来的文件
Open F For Binary As #H '用二进制方式打开一个文件
Put #H, , nStr
Close #H
Else '将文件内容读入变量 nStr
S = FileLen(F)
ReDim B(1 To S)
Open F For Binary As #H '用二进制方式打开一个文件
Get #H, , B
Close #H
nStr = StrConv(B, vbUnicode) '字符串转变为 vbUnicode 字符
End If
ReadSaveF = True
Exit Function
Exit1:
Close #H
End Function
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询