library TestDll;uses
  SysUtils,
  windows,
  Classes;function UrlDownLoadToFile(Caller,URL,FileName: PAnsiChar;Reserved: LongWord;
                           StatusCB: Pointer): LongWord;
                           stdcall; external 'URLMON.DLL' name 'URLDownloadToFileA';function downloadfile(sourcefile, destfile: string): boolean;  stdcall;begintryresult:= urldownloadtofile(nil, pchar(sourcefile), pchar(destfile), 0, nil) = 0;exceptresult:= false;end;end;procedure down;stdcall;
  begin
    downloadfile('####', '####") 
         
  end;
-----------------------------------------------------------------------
我用rundll32 testdll.dll,down 怎么不能下载????___________________________________________________________________________

解决方案 »

  1.   

    UrlDownLoadToFile本来就效果差的,这个API是简单,但控制性不如Socket的
    自己Debug找找问题吧
      

  2.   

    to ly_liuyang:
    能不能给个socket在dll应运的例子
    我找不见问题所在,你帮我写个吧
      

  3.   

    function DownLoads(const AUrl, ADestFile: String): Integer;
    var
      FFile: TFileStream;
    begin
      with TIdHTTP.Create(nil) do
      try
        FFile := TFileStream.Create(ADestFile, fmCreate or fmOpenReadWrite);
        try
          Get(AUrl, FFile);
          Result := FFile.Size;
        finally
          FFile.Free;
        end;
      finally
        Free;
      end;
    end;