Home > Back-end >  Call thunder SDK download speed, failed to create task
Call thunder SDK download speed, failed to create task

Time:09-22

The HTML code is as follows, is to create a task when it returns
'the Access violation at address 00246451 module in' XLDL. DLL '. Read of address 00000004 '.
Please god help
The unit Unit2.

Interface

USES the
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls ExtCtrls, Grids, StrUtils;
Type
PDownTaskParam=^ TDownTaskParam;
TDownTaskParam=Record
NReserved1: integer;
SzTaskUrl: String; URL//task, support HTTP, HTTPS, FTP, FTPS format
SzRefUrl: String;//can be null, HTTP download the web URL
SzCookies: String;//can be empty, the browser cookies
SzFilename: array [0.. 259] WideChar,//download your file name.
SzReserved: array [0.. 259] WideChar,
SzSavePath: array [0.. 259] WideChar,//file directory
HReserved: HWND;
BReserved1: Boolean;
SzReserved1: String [64];
SzReserved2: String [64];
IsOnlyOriginal: Boolean;//if only from the original address download
NReserved2: UINT;
BReserved2: Boolean;
IsResume: Boolean;//whether continuingly
Reserved: DWORD;
end;
TYPE
DOWN_TASK_STATUS=(NOITEM=0,
TSC_ERROR,
TSC_PAUSE,
TSC_DOWNLOAD,
TSC_COMPLETE,
TSC_STARTPENDING,
TSC_STOPPENDING);
TYPE
An unknown error TASK_ERROR_TYPE=(TASK_ERROR_UNKNOWN,//
TASK_ERROR_DISK_CREATE,//failed to create file
Failed to TASK_ERROR_DISK_WRITE,//write file
TASK_ERROR_DISK_READ,//failed to read file
TASK_ERROR_DISK_RENAME,//rename failure
TASK_ERROR_DISK_PIECEHASH,//file check failure
TASK_ERROR_DISK_FILEHASH,//full text file check failure
TASK_ERROR_DISK_DELETE,//delete file fail failure
TASK_ERROR_DOWN_INVALID,//invalid address DOWN
TASK_ERROR_PROXY_AUTH_TYPE_UNKOWN,//agent type unknown
TASK_ERROR_PROXY_AUTH_TYPE_FAILED,//proxy authentication failed
TASK_ERROR_HTTPMGR_NOT_IP,//HTTP download without IP
TASK_ERROR_TIMEOUT,//task timeout
TASK_ERROR_CANCEL,//task cancel
TASK_ERROR_TP_CRASHED,//MINITP collapse
TASK_ERROR_ID_INVALID);//TaskId illegal
Type
PDownTaskInfo=^ TDownTaskInfo;
TDownTaskInfo=record
Stat: DOWN_TASK_STATUS;
Fail_code: TASK_ERROR_TYPE;
SzFilename: array [0.. 259] WideChar,
SzReserved0: array [0.. 259] WideChar,
NTotalSize: int64;//the task total size (bytes)
NTotalDownload: int64;//download effective bytes (in the case of possible back)
FPercent: single;//download progress
NReserved0: integer;
NSrcTotal: integer;//the total number of resources
NSrcUsing: integer;//number of resources available
NReserved1: integer;
NReserved2: integer;
NReserved3: integer;
NReserved4: integer;
NReserved5: int64;
NDonationP2P: int64;//contribution to the p2p bytes
NReserved6: int64;
NDonationOrgin: int64;//the original resource sharing bytes
NDonationP2S: int64;//image sharing bytes
NReserved7: int64;
NReserved8: int64;
NSpeed: integer;//instant speed (bytes/second)
NSpeedP2S: integer;//instant speed (bytes/second)
NSpeedP2P: integer;//instant speed (bytes/second)
BIsOriginUsable: BOOLEAN;//whether the original resource effective
FHashPercent: single;//we do not provide this value
IsCreatingFile: integer;//whether is creating file
Reserved: array [0.. 63] of longint;
end;

Type
TForm2=class (TForm)
For: TButton;
Label1: TLabel;
Button2: TButton;
Edit1: TEdit;
Edit2: TEdit;
Procedure Button1Click (Sender: TObject);
Procedure FormDestroy (Sender: TObject);
Procedure Button2Click (Sender: TObject);
Private
{Private declarations}
Public
{Public declarations}
end;
EnumTaskStatus=(
EnumTaskStatus_Connect=0,//established connection
Download enumTaskStatus_Download=2,//
EnumTaskStatus_Pause=10,//pause
EnumTaskStatus_Success=11,//success download
EnumTaskStatus_Fail=12);
The function XL_CreateTask (stParam: TDownTaskParam) : THANDLE; Cdecl; External 'XLDL. DLL';
//function XL_CreateTask (stParam: TDownTaskParam) : THANDLE; Stdcall; External 'XLDL. DLL';
The function XL_QueryTaskInfoEx (hTask: THANDLE; VarstTaskInfo: TDownTaskInfo) : BOOLEAN; Cdecl; External 'XLDL. DLL';
Procedure XL_UnInit; External 'XLDL. DLL';
The Function XL_Init: Boolean; External 'XLDL. DLL';
The Function XL_StartTask (hTask: THANDLE) : BOOLEAN; External 'XLDL. DLL';


Procedure TForm2. Button1Click (Sender: TObject);
Var
The DTP: TDownTaskParam;
The begin
//XL_Init;
If not XL_Init then
The begin
Application. The MessageBox (' initialize the thunderbolt engine failure! Failed to download! ', 'warning:' MB_ICONWARNING);
The Exit;
end;
The DTP. SzTaskUrl:=(edit1. Text);//Pansichar
The DTP. SzFilename:='123. Rar';
The DTP. SzSavePath:='c: \ download;
The DTP. SzRefUrl:=' ';
The DTP. SzCookies:=' ';
TH:=XL_CreateTask (DTP);
//th:=XL_CreateTaskByURL (trim (edit2. Text), 'at c: \', '1. Rar, False);
//XLURLDownloadToFile (edit1. Text, 'c: \ movie. Rar);
If XL_StartTask (th) then
Label1. Caption:='start tasks'
The else
Label1. Caption:='can't start the task;
SHowMEssage (DTP) szSavePath);
end;

  • Related