idhttp怎么不能下载文件部分?
不知道为什么总是下下来整个文件,我设的区域明明小于文件大小,我的程序如下,是下张图片。大家帮我看看那错了
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, idhttp, idantifreeze, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
my:tidhttp;
an:tidantifreeze;
size:integer;
url:string;
s:tmemorystream;
begin
my:=tidhttp.Create(nil);
an:=tidantifreeze.Create(nil);
an.OnlyWhenIdle:=false;
s:=tmemorystream.Create;
url:='http://xxx.xxx.com/0001.JPG';
//my.Head(url);
//size:=my.Response.ContentLength;
//edit1.Text:=inttostr(size);
my.Request.ContentRangeStart:=1;
my.Request.ContentRangeEnd:=1700;
my.Get(url,s);
s.SaveToFile('d:\4.jpg');
s.Clear;
my.Destroy;
end;
end.