Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How To Download a File Without Prompting


View products that this article applies to.

Summary

The WebBrowser control and Internet Explorer have Save and Save As options that can be used to save files using the ExecWB command. However, this involves prompting from the user. There is no way to suppress this prompt. To save files to the hard-disk without prompting, use the URLDownloadToFile API from URLMON.

↑ Back to the top


More information

The declaration for URLDownloadToFile is as follows:
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
				

The function can be called as follows:
returnValue = URLDownloadToFile(0, "http://www.microsoft.com/ms.htm", _
"c:\ms.htm", 0, 0)
				
Note that when downloading HTML files, embedded content like images and objects will not be downloaded.

↑ Back to the top


Keywords: kbhowto, kburlmon, kbwebbrowser, KB244757

↑ Back to the top

Article Info
Article ID : 244757
Revision : 4
Created on : 7/1/2004
Published on : 7/1/2004
Exists online : False
Views : 397