IE时代,迅雷下载会在IE中注册并加载COM控件ThunderAgent.dll
,使用Js调起对象ThunderAgent.Agent
实现添加下载任务。
代码:
function AddLink(Url,Info,Location,strCID,strStatUrl,strCookie,strCharset)
{
if (Url != "")
{
if (Info == "")
{
Info = "unknown";
}
try
{
var ThunderAgent = new ActiveXObject("ThunderAgent.Agent");
}
catch(e)
{
ThunderAgent = new ActiveXObject("ThunderAgent.Agent64");
}
try
{
ThunderAgent.AddTask12(Url, "", "", Info, Location, strCharset, -1, 0, -1, strCookie, strCID, strStatUrl, 0, "rightup");
}
catch(e)
{
try
{
ThunderAgent.AddTask5(Url, "", "", Info, Location, -1, 0, -1, strCookie, strCID, strStatUrl, 1, "", -1);
}
catch(e)
{
ThunderAgent.AddTask2(Url, "", "", Info, Location, -1, 0, -1, strCookie);
}
}
ThunderAgent.CommitTasks2(1);
}
}