专门用语下载的.谢谢了.

解决方案 »

  1.   

    问题写清楚一些,是什么下载,HTTP ? FTP ?还是什么?
      

  2.   

    知道了,不过办法很烂。
    有知道的继续发:  [email protected]  送分。谢谢各位。
      

  3.   

    API搞定:
    Uses UrlMon;
    DownloadURLToFilehttp://lysoft.7u7.net
      

  4.   

    为什么组件不行呢,,像idhttp这样的组件你包装一下就成了函数了啊
      

  5.   

    Uses TeeURL;procedure TForm1.Button1Click(Sender: TObject);
    Var MyStream : TMemoryStream;
        ErrorCode : HResult;
    begin
      MyStream := TMemoryStream.Create;
      try
        ErrorCode:= DownloadURL('http://www.steema.com/demo.txt',MyStream);
        if ErrorCode=0 then
           Memo1.Lines.LoadFromStream(MyStream)
       else
          ShowMessage( TeeURLErrorMessage( ErrorCode ) );
      finally
        MyStream.Free;
      end;end;
      

  6.   

    请问楼上,TeeURL是什么东东?urlMon又是什么东东?HELP也没有一个
      

  7.   

    http://lysoft.7u7.net没有你说的啊,只是一个广告网站。
      

  8.   

    晕,TeeURL是你要引用的一个单元呀,不是组件unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls, TeeURL;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}
    procedure TForm1.Button1Click(Sender: TObject);
    Var MyStream : TMemoryStream;
        ErrorCode : HResult;
    begin
      MyStream := TMemoryStream.Create;
      try
        ErrorCode:= DownloadURL('http://www.steema.com/demo.txt',MyStream);
        if ErrorCode=0 then
           Memo1.Lines.LoadFromStream(MyStream)
       else
          ShowMessage( TeeURLErrorMessage( ErrorCode ) );
      finally
        MyStream.Free;
      end;end;
    end.
      

  9.   

    下载文件已经用idHttp解决了,但是下载个大的文件耗时很长,占资源太多,机器都不动了。
    我用idHttp包装在TThread里执行,仍然速度很慢,CPU占用太多,像死机了似的,有什么好办法阿?
    高手看看:Procedure _DLThread.Execute;
    Var FS:TFileStream;
        idHttpR:TidHttp;
        sInfo, sURL,sFile:String;
    Begin
        if Suspended then Begin
            //Suspend;
            Exit;
        End;
        sURL:=sDownLoadURL;
        sFile:=sTargetFile;
        //
        if (sUrl='') or (sFile='') then Exit;
        //
        With Frm_MDI do     //,Frm_MDI.idHttp1
        Try
            sInfo:='下载文件['+sURL+']到['+sFile+']';
            ShowInfo('开始'+sInfo+'... ...');
            if FileExists(sFile) then DeleteFile(sFile);
            //句柄属于线程  idHttp1:=tIDHttp.Create(Application);
            //
            Try
                FS:=TFileStream.Create(sFile,fmCreate);   //文件流
                idHttpR.Get(sURL,FS);                          //下载
                //
                ShowInfo(sInfo+'完毕');
            Except
                On E:Exception do Begin
                    ShowInfo('[DownLoadHttpFile]'+sInfo+'失败'+#13+E.message);
                    ShowMessage('[DownLoadHttpFile]'+sInfo+'出错!'+#13+E.message);
                End;
            End;
            //
        Finally
            If Assigned(FS) then FS.Free;
            if Assigned(idHttpR) then idHttpR.Free;
        End;
        //Suspended:=True;
    End;
      

  10.   

    cyBlueBoy,你的TEEURL在哪里有阿?是下载的吗?还是你自己做的,下载时占CPU资源多吗?是不是也慢的像死机一样?
      

  11.   

    TeeUrl 不是自带的。]TeeUrl 是哪里的?
      

  12.   

    都说了API函数,还不会自己去Google上找么?LYSoft自然是我的主页,当然不提供这些基础的东西的
    需要APIHook,NT Ring0等的才去我那里找的http://lysoft.7u7.net