|
用Delphi实现整个网站图片的极速下载(4) end; end; end; Memo1.Lines.Add('All OK!'); finally strm.Free; end; end; procedure TForm1.Button2Click(Sender: TObject); begin Close; end; { TGetMM } constrUCtor TGetMM.Create(MMUrl,DestPath,SubJ: string); begin FMMUrl :=MMUrl; FDestPath :=DestPath; FSubJ :=SubJ; inherited Create(False); end; procedure TGetMM.Execute; var strm:TMemoryStream; IdGetMM: TIdHTTP; DestFile:string; begin try strm :=TMemoryStream.Create; IdGetMM :=TIdHTTP.Create(nil); try DestFile :=FDestPath+FSubJ+'.jpg'; if Not FileExists(DestFile) then begin strm.Clear; IdGetMM.Get(FMMUrl+FSubJ+'.jpg',strm); strm.SaveToFile(DestFile); end; DestFile :=FDestPath+'tn_'+FSubJ+'.jpg'; if not FileExists(DestFile) then begin strm.Clear; IdGetMM.Get(FMMUrl+'tn_'+FSubJ+'.jpg',strm); strm.SaveToFile(DestFile); end; except end; finally strm.Free; IdGetMM.Free; end; end; procedure TForm1.GetMMThread(MMUrl, DestPath, SubJ: string);
|