Problem Source: http://www.cnblogs.com/del/archive/2009/02/27/1370907.html#1463071
In this example:
Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, idbasecomponent, idcomponent, idtcpconnection, idtcpclient, idhttp, stdctrls; type tform1 = Class (tform) button1: tbutton; idhttp1: tidhttp; Procedure button1click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} uses JPEG; Procedure tform1.button1click (Sender: tobject); const ur L = 'HTTP: // ptlogin2.qq.com/getimage? Aid = 15000701 & 0.9129723031485226 '; var MS: tmemorystream; JPG: t1_image; begin MS: = tmemorystream. create; JPG: = tsf-image. create; idhttp1.get (URL, MS); Ms. position: = 0; JPG. loadfromstream (MS); canvas. draw (10, 10, JPG); JPG. free; Ms. free; end.
Form file:
Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 126 clientwidth = 158 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false pixelsperinch = 96 textheight = 13 object button1: tbutton left = 40 top = 88 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 = 8 Top = 8 endend