Save webpage using webbrowser control

我们两清 提交于 2019-12-06 12:28:31
MarkJ

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) 

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.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!