function getcook():boolean;
var
str2,cookies:string;
begin
result:=false;
if CanGetIECookie(hosturl,str2) then
iecookie:=copy(str2,pos('warlord2',str2),length(str2)-pos('warlord2',str2)+1)
else
exit;
procedure TForm1.IdCookieManager1NewCookie(ASender: TObject;
ACookie: TIdCookieRFC2109; var VAccept: Boolean);
begin
idcookiestr:=acookie.ClientCookie;
end;
function TForm1.CanGetIECookie(const URL:string;var Cookie:string):boolean;
var
lpvBuffer:array[0..1000] of byte;
lpdwBufferLength:cardinal;
begin
lpdwBufferLength:=sizeof(lpvBuffer);
result:=InternetGetCookie(PChar(URL),nil,@lpvBuffer,lpdwBufferLength);
if result then
Cookie:=pchar(@lpvBuffer);
end;