Red de conocimiento informático - Problemas con los teléfonos móviles - Problema de VB al usar el control bkDLControl para descargar archivos

Problema de VB al usar el control bkDLControl para descargar archivos

De hecho, no necesita usar el control bkdlcontrol, simplemente cambie el txturl a list1.list(i)~

'Agregar control de transferencia de Internet 6.0 y controles comunes de Windows 6.0

' Código de formulario: '

Sub privado cmdGET_Click()

StartDownLoad txtURL

End Sub

Sub privado Form_Load()

savefile.Text = App.Path

End Sub

Private Sub StartDownLoad(ByVal Geturl As String)

Dim spo%, filename$

Dim fso, f

Establecer fso = CreateObject(" Scripting.FileSystemObject")

Si no es fso.FolderExists(App.Path & "\download" ) Luego establezca f = fso. download")

spo = InStrRev(Geturl, "/")

filename = Right(Geturl, Len(Geturl) - spo) 'Obtener nombre de archivo

savefile.Text = App.Path & "\download")

Si no es fso.FolderExists(App.Path & "\download"), establezca f = fso.Path & "\ descargar \" y nombre de archivo

Inet1.Execute Geturl, "get" 'Iniciar descarga

End Sub

Private Sub Inet1_StateChanged(ByVal State As Integer)

'Cuando Estado = 12, use el método GetChunk para leer la respuesta del servidor

Dim vtData() As Byte

Seleccionar caso Estado

'...No se enumeran otras condiciones.

Case icError ' 11

'Devuelve ResponseCode y ResponseInfo cuando ocurre un error.

vtData = Inet1.ResponseCode & ":" & Inet1.ResponseInfo

Caso icResponseCompleted ' 12

Dim bDone As Boolean: bDone = False

'Obtiene el primer bloque.

vtData() = Inet1.GetChunk(1024, 1)

DoEvents

Abrir savefile.Text para acceso binario Escribir como #1 'Establecer la ruta de guardado archivo y comience a guardar

'Obtenga la longitud del archivo descargado

If Len(Inet1.GetHeader("Content-Left", "Content-Left", "Content-Left" , "Contenido izquierdo", "Contenido izquierdo", "Contenido izquierdo", "Contenido izquierdo", "Contenido izquierdo", "Contenido izquierdo0 Luego ProgressBar1.Max = CLng(Inet1.GetHeader("Contenido-Longitud") )

'Recorrer fragmentos

'Hacer mientras no se guarda el archivo.p>

Hacer mientras no bListo

Poner #1, Loc(1 ) + 1, vtData()

vtData() = Inet1.GetChunk(1024, 1)

DoEvents

ProgressBar1.Value = Loc( 1) ' Establece la longitud de la barra de progreso

Si Loc(1) >= ProgressBar1.Max Entonces bDone = True