Just thinking about using thunderbolt open component download files of more than 2 g, but unable to download,
Master have a look at this code to what is going wrong,
This code is derived from the network.
Download win10 ISO image, although can download, but the data has a problem! If not fully download, also does not have the download is complete hint,
http://www.vbgood.com/forum.php? Mod=attachment& Aid=NDAzNTR8NTNlMDUxOGZ8MTYyMTA5NTIyOHwwfDEwNDM0Mw % 3 d % 3 d
Option Explicit
Public Declare Function XLInitDownloadEngine Lib "XLDownload. DLL () As" Long
Public Declare Function XLURLDownloadToFile Lib "XLDownload. DLL" (ByRef pszFileName As Any, ByRef pszUrl As Any, ByRef pszRefUrl As Any, ByRef lTaskId As Long) As Long
Public Declare Function XLQueryTaskInfo Lib "XLDownload. DLL" (ByVal lTaskId As Long, ByRef plStatus As Long, ByRef pullFileSize As Currency, ByRef pullRecvSize As Currency) As Long
Public Declare Function XLPauseTask Lib "XLDownload. DLL" (ByVal lTaskId As Long, ByRef lNewTaskId As Long) As Long
Public Declare Function XLContinueTask Lib "XLDownload. DLL" (ByVal lTaskId As Long) As Long
Public Declare Function XLContinueTaskFromTdFile Lib "XLDownload. DLL" (ByRef pszTdFileFullPath As Any, ByRef lTaskId As Long) As Long
Public Declare Sub XLStopTask Lib "XLDownload. DLL" (ByVal lTaskId As Long)
Public Declare Function XLUninitDownloadEngine Lib "XLDownload. DLL () As" Long
Public Declare Function XLGetErrorMsg Lib "XLDownload. DLL" (ByVal dwErrorId As Long, ByVal pszBuffer As Any, ByRef dwSize) As Long As Long
Public Enum enumTaskStatus
EnumTaskStatus_Connect=0 ',//have established links
Download enumTaskStatus_Download=2 ',//
EnumTaskStatus_Pause=10 ',//pause
EnumTaskStatus_Success=11 ',//success download
EnumTaskStatus_Fail=12 ',//download failure
End Enum
Public Const XL_SUCCESS As Long=0
Public Const XL_ERROR_FAIL As Long=& amp; H10000000
Initialized '//not
Public Const XL_ERROR_UNINITAILIZE As Long=XL_ERROR_FAIL + 1
'//not supported by the agreement, only support HTTP and FTP
Public Const XL_ERROR_UNSPORTED_PROTOCOL As Long=XL_ERROR_FAIL + 2
'//initializes the tray icon failure
Public Const XL_ERROR_INIT_TASK_TRAY_ICON_FAIL As Long=XL_ERROR_FAIL + 3
'//add the tray icon failure
Public Const XL_ERROR_ADD_TASK_TRAY_ICON_FAIL As Long XL_ERROR_FAIL + 4=
'//a pointer to an empty
Public Const XL_ERROR_POINTER_IS_NULL As Long XL_ERROR_FAIL + 5=
'//string is an empty string
Public Const XL_ERROR_STRING_IS_EMPTY As Long XL_ERROR_FAIL + 6=
'//incoming path does not contain the file name
Public Const XL_ERROR_PATH_DONT_INCLUDE_FILENAME As Long=XL_ERROR_FAIL + 7
'//' failed to create a directory
Public Const XL_ERROR_CREATE_DIRECTORY_FAIL As Long XL_ERROR_FAIL + 8=
'/memory/
Public Const XL_ERROR_MEMORY_ISNT_ENOUGH As Long=XL_ERROR_FAIL + 9
'//parameter illegal
Public Const XL_ERROR_INVALID_ARG As Long XL_ERROR_FAIL + 10=
'//task does not exist
Public Const XL_ERROR_TASK_DONT_EXIST As Long XL_ERROR_FAIL + 11=
'//filename illegal
Public Const XL_ERROR_FILE_NAME_INVALID As Long=XL_ERROR_FAIL + 12
'//not implement
Public Const XL_ERROR_NOTIMPL As Long=XL_ERROR_FAIL + 13
'//create task to limit, cannot continue to create
Public Const XL_ERROR_TASKNUM_EXCEED_MAXNUM As Long=XL_ERROR_FAIL + 14
Option Explicit
Dim lTaskId As Long
Dim dwRet As Long
Dim ullFileSize As Currency
Dim ullRecvSize As Currency
Dim lStatus As Long
Dim Inited As Boolean
Dim Paused As Boolean
Private Sub Command1_Click ()
If XLInitDownloadEngine=0 Then
Label1. Caption="engine failed to initialize"
The Exit Sub
The Else
Inited=True
End the If
Dim tdFilePath As String
TdFilePath=App. Path & amp; "\ hfyg. Exe. Td"
DwRet=XLContinueTaskFromTdFile (ByVal StrPtr (tdFilePath), lTaskId)
If dwRet & lt;> XL_SUCCESS Then
MsgBox "continue to fail"
The Else
Timer1. Enabled=True
Timer1. Interval=1000
Label1. Caption="continue to download, TaskId=" & amp; LTaskId
Command4. Enabled=False
End the If
End Sub
Private Sub Command2_Click ()
If XLInitDownloadEngine=0 Then
Label1. Caption="initialize engine failure."
The Exit Sub
The Else
Inited=True
End the If
Dim the url As a String
Dim As filePath String
FilePath=Text2. Text
Url=Text1. Text
DwRet=XLURLDownloadToFile (ByVal StrPtr (filePath), ByVal StrPtr (url), ByVal StrPtr (" "), lTaskId)
If dwRet & lt;> XL_SUCCESS Then
MsgBox "add tasks fail"
The Else
Timer1. Enabled=True
Timer1. Interval=1000
Label1. Caption="to start the download, TaskId=" & amp; LTaskId
Command3. Enabled=True
End the If
End Sub
Private Sub Command3_Click ()
Dim lNewTaskId As Long
If Paused=True Then
DwRet=XLContinueTask (lTaskId)
If dwRet & lt;> XL_SUCCESS Then
Label1. Caption="continue to fail"
The Exit Sub
The Else
Label1. Caption="continue to download, TaskId=" & amp; LTaskId
Paused=False
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull