展开全部
先在“部件”里添加internet Transfer Control控件,放到窗体上,名字按默认再添加一个按钮,名字也按默认然后复制下面的代码:Private Sub Command1_Click()Inet1.Protocol = icHTTPInet1.RemotePort = 80Inet1.URL = " http://xue.yn66.com/Sound/song/cafee/whateveryoulike.mp3" Inet1.Execute , "Get"End SubPrivate Sub Inet1_StateChanged(ByVal State As Integer)'Dim aa As VariantDim vtData() As Byte '数据变量。If State = 12 ThenOpen "c:\tianqiju.mp3" For Binary Access Write As #1vtData = Inet1.GetChunk(1024, icByteArray)Do While UBound(vtData) > 0DoEventsPut #1, , vtDatavtData = Inet1.GetChunk(1024, icByteArray)LoopPut #1, , vtDataClose #1MsgBox "下载完毕"End IfEnd Sub点击按钮就会下载一首歌到你的C盘,你可以改成其他东西。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |