当我用IdHttp.Get(URL,FileStreaM);下载时
有什么方法在下载半途中中断下载?
IdHttp没有Abort()方法.
敬请指点

解决方案 »

  1.   

    Disconnect方法如何?看看Help和文档吧http://lysoft.7u7.net
      

  2.   

    我自己已经找到解决方法了
    DownStop:Boolean;procedure TForm1.StopClick(Sender: TObject);
    begin
      DownStop:=true;
    end;procedure TForm1.IdHTTP1Work(Sender: TObject; AWorkMode: TWorkMode;
      const AWorkCount: Integer);
    begin
      If IdHTTP1.Response.ContentLength<0 then
        Exit;
      ProgressBar1.Max:=IdHTTP1.Response.ContentLength;  ProgressBar1.Position:=AWorkCount;
      Label2.Caption:=Format('已下载:%2.0f%%;%d/%d',
                                    [(AWorkCount/IdHTTP1.Response.ContentLength)*100
                                      ,AWorkCount,IdHTTP1.Response.ContentLength]);  Application.ProcessMessages;
      if DownStop then
      begin
        IdHTTP1.Disconnect;
      end; //end ifend;