WEBBROWSER控件怎样设置为不加载图片?

修改注册表会影响IE,VB用WININET会线程堵塞。有没有办法不让WEBBROWSER不加载图片?或有没有只下载源代码的网页控件或方法?1楼的,您能补充把c:\baid... 修改注册表会影响IE,VB用WININET会线程堵塞。有没有办法不让WEBBROWSER不加载图片?或有没有只下载源代码的网页控件或方法?
1楼的,您能补充把c:\baidu.com的源代码复制到text1的代码吗,如果可以我给多10分
展开
 我来答
百度网友4b636fa
推荐于2016-10-30 · TA获得超过1237个赞
知道小有建树答主
回答量:866
采纳率:100%
帮助的人:1399万
展开全部
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
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式