CodeItBetter Programming Another VB Programming Blog

How to Download a file from the Internet — without getting a dialog box (in two ways)

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'Internet - How to Download a file from the Internet -- without getting a dialog box (in two ways)
'Method 1:

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 Form_Load()
    Dim llRetVal As Long
    llRetVal = URLDownloadToFile(0, "http://www.yahoo.com", "c:\Temp.htm", 0, 0)
End Sub
 
'Method 2:

Private Declare Function DoFileDownload Lib "shdocvw.dll" (ByVal lpszFile As String) As Long
 
Public Sub DownloadFile(FileURL As String)
    Dim sDownload As String
 
    sDownload = StrConv(FileURL, vbUnicode)
    Call DoFileDownload(sDownload)
End Sub

Related posts:

  1. How to Download file from Internet
  2. How to check whether the system is connected with internet (in two ways)
  3. How to Dis-connect Internet programmatically (in two ways)
  4. How to connect Internet programmatically (in two ways)
  5. How to open the Date and Time Properties Dialog (in two ways)
  6. How to Return the file portion of a file + pathname without extension (in two ways)
  7. How to Change Internet Explorer Start Page and Main Window Title
  8. How to read text file contents for a given file (in four ways)
  9. How to Return the file portion of a file + pathname (in two ways)
  10. How to open a new window of Internet Explorer and browse to a specific file

Filed under: Internet Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.