【发布时间】:2010-12-01 10:26:54
【问题描述】:
我的问题与other question I have asked about loading image from the URL 有关。 下面的代码有效。 但是,如果我尝试获取图像(假设存在),我遇到了问题,但是 显然被删除了。应用程序不知道并返回错误。 有没有办法通过捕获传入的错误来防止它。 我将不胜感激任何建议。 它发生在他的线上:
IdHTTP1.get('http://www.google.com/intl/en_ALL/images/logo.gif',MS);
谢谢, 克里斯
uses
GIFImg;
procedure TForm1.btn1Click(Sender: TObject);
var
MS : TMemoryStream;
GIf: TGIFImage;
begin
MS := TMemoryStream.Create;
GIf := TGIFImage.Create;
try
IdHTTP1.get('http://www.google.com/intl/en_ALL/images/logo.gif',MS);
Ms.Seek(0,soFromBeginning);
Gif.LoadFromStream(MS);
img1.Picture.Assign(GIF);
finally
FreeAndNil(GIF);
FreeAndNil(MS);
end;
end;
【问题讨论】:
标签: delphi http exception-handling indy