关于vb下载保存路径问题高手进帮我修改下代码
问题就是为什么我设置完下载文件保存路径,点击下载按钮的时候它那个保存路径会自动改成我这个工程里文件夹路径不管怎么设置都不行啊,哪位高手帮我看看,是代码的问题。还是怎么回事...
问题就是为什么我设置完下载文件保存路径,点击下载按钮的时候它那个保存路径会自动改成 我这个工程里文件夹路径不管怎么设置都不行啊,哪位高手帮我看看,是代码的问题。还是怎么回事
Private Sub StartDownLoad(ByVal Geturl As String)
Dim spo%, filename$
spo = InStrRev(Geturl, "/")
filename = Right(Geturl, Len(Geturl) - spo)
text2.Text = App.Path & "\download\" & filename
Inet1.Execute Geturl, "get"
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
'State = 12 时,用 GetChunk 方法检索服务器的响应。
Dim vtData() As Byte
Select Case State
Case icHostResolvingHost
label3.Caption = "正在查询所指定的主机的 IP 地址"
Case icHostResolved
label3.Caption = "成功地找到所指定的主机的 IP 地址"
Case icConnecting
label3.Caption = "正在与主机连接"
Case icConnected
label3.Caption = "已与主机连接成功"
Case icRequesting
label3.Caption = "正在向主机发送请求"
Case icRequestSent
label3.Caption = "发送请求已成功"
Case icReceivingResponse
label3.Caption = "在接收主机的响应"
Case icResponseReceived
label3.Caption = "成功地接收到主机的响应"
Case icDisconnecting
label3.Caption = "正在解除与主机的连接"
Case icDisconnected
label3.Caption = "已成功地与主机解除了连接"
Case icError
label3.Caption = "与主机通讯时出现了错误"
'出现错误时,返回 ResponseCode 和 ResponseInfo。
vtData = Inet1.ResponseCode & ":" & Inet1.ResponseInfo
Case icResponseCompleted ' 12
Dim bDone As Boolean: bDone = False
'取得第一个块。
vtData() = Inet1.GetChunk(1024, 1)
DoEvents
Open text2.Text For Binary Access Write As #1
If Len(Inet1.GetHeader("Content-Length")) > 0 Then ProgressBar1.Max = CLng(Inet1.GetHeader("Content-Length"))
Do While Not bDone
Put #1, Loc(1) + 1, vtData()
vtData() = Inet1.GetChunk(1024, 1)
DoEvents
ProgressBar1.Value = Loc(1)
If Loc(1) >= ProgressBar1.Max Then bDone = True
Loop
Close #1
MsgBox "下载完成,请检验download目录里的文件是否完整!", vbInformation, "通知"
End Select
End Sub 展开
Private Sub StartDownLoad(ByVal Geturl As String)
Dim spo%, filename$
spo = InStrRev(Geturl, "/")
filename = Right(Geturl, Len(Geturl) - spo)
text2.Text = App.Path & "\download\" & filename
Inet1.Execute Geturl, "get"
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
'State = 12 时,用 GetChunk 方法检索服务器的响应。
Dim vtData() As Byte
Select Case State
Case icHostResolvingHost
label3.Caption = "正在查询所指定的主机的 IP 地址"
Case icHostResolved
label3.Caption = "成功地找到所指定的主机的 IP 地址"
Case icConnecting
label3.Caption = "正在与主机连接"
Case icConnected
label3.Caption = "已与主机连接成功"
Case icRequesting
label3.Caption = "正在向主机发送请求"
Case icRequestSent
label3.Caption = "发送请求已成功"
Case icReceivingResponse
label3.Caption = "在接收主机的响应"
Case icResponseReceived
label3.Caption = "成功地接收到主机的响应"
Case icDisconnecting
label3.Caption = "正在解除与主机的连接"
Case icDisconnected
label3.Caption = "已成功地与主机解除了连接"
Case icError
label3.Caption = "与主机通讯时出现了错误"
'出现错误时,返回 ResponseCode 和 ResponseInfo。
vtData = Inet1.ResponseCode & ":" & Inet1.ResponseInfo
Case icResponseCompleted ' 12
Dim bDone As Boolean: bDone = False
'取得第一个块。
vtData() = Inet1.GetChunk(1024, 1)
DoEvents
Open text2.Text For Binary Access Write As #1
If Len(Inet1.GetHeader("Content-Length")) > 0 Then ProgressBar1.Max = CLng(Inet1.GetHeader("Content-Length"))
Do While Not bDone
Put #1, Loc(1) + 1, vtData()
vtData() = Inet1.GetChunk(1024, 1)
DoEvents
ProgressBar1.Value = Loc(1)
If Loc(1) >= ProgressBar1.Max Then bDone = True
Loop
Close #1
MsgBox "下载完成,请检验download目录里的文件是否完整!", vbInformation, "通知"
End Select
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询