netants和吸血鬼都提供了com接口
uses activex,comobj;
procedure tfrmudp.downloadbysoft(soft, fileurl: string); //download by soft like Netants or Netvampire
var
nv, na: Variant;
begin
if soft = 'nv' then
begin
CoInitialize(nil);
try
NV := CreateOleObject('Vampire.NewJob');
if VarType(NV) <> varDispatch
then raise Exception.Create('Cannot connect to Net Vampire');
NV.Initialize('', fileurl);
finally
CoUninitialize;
end;
end
else
if soft = 'na' then
begin
CoInitialize(nil);
try
Na := CreateOleObject('netants.api');
if VarType(na) <> varDispatch
then raise Exception.Create('Cannot connect to NetAnts');
na.addurl(fileurl, '', '');
finally
CoUninitialize;
end;
end;
end;