Delphi TWebBrowser 获取cookie


本文整理自网络,侵删。

 
unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.OleCtrls, SHDocVw;

type
  TForm1 = class(TForm)
    Memo1: TMemo;
    PJWeb: TWebBrowser;
    Button1: TButton;
    Button2: TButton;
    procedure PJWebNewWindow2(ASender: TObject; var ppDisp: IDispatch;
      var Cancel: WordBool);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses ActiveX, MSHTML, ShellAPI;




procedure TForm1.Button1Click(Sender: TObject);
var
  doc, doc1: IHTMLDocument2;
  all: IHTMLElementCollection;
  len, i, j, L: integer;
begin
  doc := pjweb.Document as IHTMLDocument2;
  memo1.Text := doc.cookie;

 // doc.cookie := '11111111111111111111111';
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
PJWeb.Navigate('http://www.delphitop.com/');
end;

procedure TForm1.PJWebNewWindow2(ASender: TObject; var ppDisp: IDispatch;
  var Cancel: WordBool);
begin
Cancel := true;
end;

end.

相关阅读 >>

Delphi firemonkey的屏幕分辨率hdpi、mdpi、ldpi的差别

Delphi 对gzip解压

Delphi如何在一个窗体中嵌入另一个窗体

Delphi整理八(对话框)

Delphi 配置驱动程序(firedac)

Delphi中指针和地址切换的方法

Delphi Delphi tparallel cleanup needed用法

Delphi 侧边栏隐藏窗体

Delphi 递归获取文件夹大小

Delphi 通过指点操作获得窗口句柄

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...