Problem Source: http://www.cnblogs.com/del/archive/2008/07/29/1255817.html#1271328
In this example:
Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, idbasecomponent, idcomponent, idtcpconnection, idtcpclient, idhttp, extctrls; type tform1 = Class (tform) image1: timage; idhttp1: tidhttp; button1: tbutton; Procedure button1click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} uses gifimg; Procedure tform1.button1click (Sender: tobject); const downurl = 'HTTP: // others {file to be downloaded} var STM: tmemorystream; GIF: tgifimage; begin STM: = tmemorystream. create; idhttp1.get (downurl, STM); STM. position: = 0; GIF: = tgifimage. create; GIF. loadfromstream (STM); image1.picture. graphic: = GIF; GIF. free; STM. free; end.
Form file:
Object form1: tform1 left = 0 Top = 0 caption = 'form1 'clientheight = 127 clientwidth = 249 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false pixelsperinch = 96 textheight = 13 object image1: timage left = 10 top = 10 width = 105 Height = 105 end object button1: tbutton left = 152 Top = 80 width = 75 Height = 25 caption = 'button1' taborder = 0 onclick = button1click end object idhttp1: tidhttp allowcookies = true proxyparams. basicauthentication = false proxyparams. proxyport = 0 request. contentlength =-1 request. accept = 'text/html, */* 'request. basicauthentication = false request. useragent = 'mozilla/3.0 (compatible; Indy Library) 'httpoptions = [hoforceencodeparams] Left = 112 Top = 40 endend