views:

945

answers:

1

Hi,

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.

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.

Thanks. Tawfiq.

+1  A: 

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!

MarkJ