VB编程里如果要弄一个按钮、点击一下就可以进入一个直链下载地址,下载完后自动打开的代码是什么?
展开全部
这要根据你这个链接下载的数据类型而定,是网页?文本文件?Office文档?还是图片、音频、视频?或者是可执行文件?压缩文件?不同的类型有不同的处理方式。
更多追问追答
追问
额。。。我像要压缩文件和exe文件的,能告诉我吗,最好能把代码分别打出来之后截个图。。谢谢,能加一下我QQ吗,我希望日后你能教我
追答
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 Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()
URLDownloadToFile 0&, "网址写在这里", "下载后的文件名及路径写在这里", 0&, 0&
ShellExecute Me.hWnd, "open", "下载后的文件名及路径写在这里", "", "", 0&
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询