//************************************************************** 点击启动按钮 ************************************************************************//
procedure TForm1.activeButtonClick(Sender: TObject);
begin
if activeButton.Caption ='启动' then
begin
if downloadAdd.Text = '' then //判断是否是空地址
begin
ShowMessage('下载地址无效!');
Exit;
end;
activeButton.Caption:='停止';
downloadAdd.Enabled:=false;
Timer1.Enabled:=false;
handle1:=FindWindow(nil, PChar('迅雷VIP尊享版')); //查找迅雷主窗口,获得句柄 handle1
if handle1 <> 0 then
begin
//SetWindowPos(handle1,HWND_TOPMost,0,0,0,0,0);
GetWindowRect(handle1,R1); //定位窗口位置
ImitateClick(R1.Left+189,R1.Top+88); //设置鼠标位置 (“新建”),单击
Sleep(300);
procedure TForm1.DeleteDF(fName: String); //功能:删除相同前缀文件
begin
if FindFirst(downloadPath.Text+'\'+fName+'*.*',faAnyFile,SearchRec) =0 then
begin //查找相同前缀文件
repeat
DeleteFile(downloadPath.Text+'\'+SearchRec.Name); //删除相同前缀文件
until(FindNext(SearchRec)<>0);
FindClose(SearchRec);
end;
end;