Problem Source: http://www.cnblogs.com/del/archive/2009/02/27/1399526.html#1463307
In this example:
Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) button1: tbutton; button2: tbutton; button3: tbutton; button4: tbutton; Procedure submit (Sender: tobject ); procedure button4click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} uses wininet; const url = 'HTTP: // www.sohu.com '; Procedure tform1.button1click (Sender: tobject); var Buf: array [0 .. 1024*4-1] of char; Size: DWORD; begin internetgetcookie (pchar (URL), nil, Buf, size); showmessage (BUF); end; Procedure tform1.button2click (Sender: tobject); var Buf: array [0 .. 255] of char; Size: DWORD; begin internetgetcookie (pchar (URL), 'yyid', Buf, size); showmessage (BUF); end; Procedure tform1.button3click (Sender: tobject); begin internetsetcookie (pchar (URL), 'wanyi', '000000'); end; Procedure tform1.button4click (Sender: tobject); var Buf: array [0 .. 255] of char; Size: DWORD; begin internetgetcookie (pchar (URL), 'wanyi', Buf, size); showmessage (BUF); end; Procedure tform1.formcreate (Sender: tobject); begin button1.caption: = 'extract all data of the specified website cookies '; button2.caption: = 'extract specified data from the specified website cookies'; button3.caption: = 'write cookie to the specified website '; button4.caption: = 'extract the cookie that has just been written'; end.
Form file:
Object form1: tform1 left = 0 Top = 0 caption = 'form1 'clientheight = 146 clientwidth = 328 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false position = podesktopcenter oncreate = formcreate pixelsperinch = 96 textheight = 13 object button1: tbutton left = 48 Top = 8 width = 233 Height = 25 caption = 'button1' taborder = 0 onclick = button1click end object button2: tbutton left = 48 Top = 39 width = 233 Height = 25 caption = 'button2' taborder = 1 onclick = button2click end object button3: tbutton left = 48 Top = 80 width = 233 Height = 25 caption = 'button3' taborder = 2 onclick = button3click end object button4: tbutton left = 48 Top = 111 width = 233 Height = 25 caption = 'button4' taborder = 3 onclick = button4click endend