1,593
社区成员
发帖
与我相关
我的任务
分享
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;
procedure TFRM_base64.Button46Click(Sender: TObject);
const
INTERNET_COOKIE_HTTPONLY = 8192 ;
var
hModule:THandle;
lp:pointer;
InternetGetCookieEx:function(lpszUrl, lpszCookieName,lpszCookieData: PChar; var lpdwSize: DWORD;dwFlags:DWORD;lpReserved: Pointer): BOOL;StdCall;
CookieSize:DWORD;
cookiedata:string;
thebool:bool;
begin
hModule:=GetModuleHandle('wininet.dll');
if hModule<>0 then
begin
@InternetGetCookieEx:=GetProcAddress(hModule,'InternetGetCookieExA');
memo4.lines.Append('have func');
if @InternetGetCookieEx<>nil then
begin
CookieSize:=1024;
Setlength(CookieData,CookieSize);
memo4.lines.Append('cookies:');
thebool:=InternetGetCookieEx(PAnsiChar(trim(memo1.Text)),nil,PAnsiChar(CookieData),CookieSize,INTERNET_COOKIE_HTTPONLY,nil);
if thebool then
memo4.lines.Append(CookieData);
end;
end;
end;
var
Version: Extended;
begin
Version := StrtoFloat(Format('%d.%d', [Win32MajorVersion, Win32MinorVersion]));
// 大于等于 5.1 就是XP以上系统了
if Version >= 5.1 then
……
end;