procedure TForm1.Button1Click(Sender: TObject);
const
INTERNET_COOKIE_HTTPONLY = 8192;
var
hModule: THandle;
lp: Pointer;
InternetGetCookieEx: function(lpszUrl, lpszCookieName, lpszCookieData
: PAnsiChar; var lpdwSize: DWORD; dwFlags: DWORD; lpReserved: pointer)
: BOOL; stdCall;
CookieSize: DWORD;
CookieData: PAnsiChar;
begin
LoadLibrary('wininet.dll');
hModule := GetModuleHandle('wininet.dll');
if hModule <> 0 then
begin
@InternetGetCookieEx := GetProcAddress(hModule, 'InternetGetCookieExA');
if @InternetGetCookieEx <> nil then
begin
CookieSize := 1024;
Cookiedata := AllocMem(CookieSize);
if InternetGetCookieEx('http://www.baidu.com', nil, Cookiedata, CookieSize, INTERNET_COOKIE_HTTPONLY, nil) then
Memo1.lines.Append(cookiedata);
FreeMem(Cookiedata);
end;
end;
end;
本文链接:https://it72.com:4443/187.htm