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 数据库获取所有用户名

Delphi下载官方svn中的示例原码

[Delphi]钩子(hook)机制的使用

Delphi 强制删除文件 zwdeletefile

Delphi 将汉字翻译成拼音缩写的函数

Delphi 去掉twebbrowser的滚动条

Delphi concat 字符串函数

Delphi antiemupeb

Delphi ado通用操作数据单元

Delphi获取ie路径

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



打赏

取消

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

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

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

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

评论

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