使用 webbrowser 控件保存网页 [英] Save webpage using webbrowser control

查看:38
本文介绍了使用 webbrowser 控件保存网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 VB6 和 webbrowser 控件导航到网页.我想在没有任何人工干预的情况下定期保存我访问过的页面.

I am using VB6 and the webbrowser control to navigate to to webpages. I want to save the pages I visit in regular intervals without any manual intervention.

我知道如何使用 DOM 解析 HTML.但也需要在不弹出任何对话框的情况下保存页面.

I know how to parse HTML using DOM. But also need to save the pages without dispaling any dialog box.

这可能吗?将不胜感激.

Is this possible? Will appreciate some help.

谢谢.陶菲克.

推荐答案

这篇 Microsoft 知识库文章 (Q244757) 表示无法使用 Web 浏览器控件执行此操作,但提供了使用 UrlMon.dll 的替代解决方案,我已将其放在下面.

This Microsoft KnowledgeBase article (Q244757) says there's no way to do this with the Web Browser control, but gives an alternative solution using UrlMon.dll, which I've put below.

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 

returnValue = URLDownloadToFile(0, "http://www.microsoft.com/ms.htm", _
  "c:\ms.htm", 0, 0) 

显然,它不会下载图像等嵌入内容.UrlMon.dll 需要 Internet Explorer 3,所以它可以在任何现代 PC 上使用.

It won't download embedded content like images, apparently. UrlMon.dll requires Internet Explorer 3, so it is going to be available on any modern PC.

对于奖励分数,这里是如何在 100% 原生 VB6 中异步下载多个文件,完全没有 API 调用!

And for bonus marks, here's how to download multiple files asynchronously, in 100% native VB6, without no API calls at all!

这篇关于使用 webbrowser 控件保存网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆