End SubPrivate Sub Form_Load() Text1.Text = "http://www.chat.ru/~softdaily/fo-ag162.zip" Form1.Caption = "Audiograbber 1.62 Full" Text2.Text = "http://www6.50megs.com/audiograbber/demos/cr-ag161.zip" End Sub
'把指定给定一个网络文件(任何类型,可以是图像文件)的地址,然后用程序把其保存为本机器的文件 Public 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'保存网上的图片到硬盘 'URL是图版的网址 'LocalFilename 是保存到本地的文件名及目录 '使用例子:DownloadFile "http://www.21cn.com/aa.jpg","c:\aa.jpg"Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean Dim lngRetVal As Long lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0) If lngRetVal = 0 Then DownloadFile = True End Function
Private Declare Function DoFileDownload Lib "shdocvw.dll" (ByVal lpszFile As String) As Long
Private Sub Command1_Click()
Dim sDownload As String
sDownload = StrConv(Text1.Text, vbUnicode)
Call DoFileDownload(sDownload)
End SubPrivate Sub Form_Load()
Text1.Text = "http://www.chat.ru/~softdaily/fo-ag162.zip"
Form1.Caption = "Audiograbber 1.62 Full"
Text2.Text = "http://www6.50megs.com/audiograbber/demos/cr-ag161.zip"
End Sub
Public 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'保存网上的图片到硬盘
'URL是图版的网址
'LocalFilename 是保存到本地的文件名及目录
'使用例子:DownloadFile "http://www.21cn.com/aa.jpg","c:\aa.jpg"Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function