5D艺术网首页
商城
|
资讯
|
作品
|
博客
|
教程
|
论坛
登录
注册
加为好友
发短消息
来自:郑州
性别:先生
最后登录:2011-04-27
http://wwle.5d.cn/
我有一对翅膀,不是用来飞翔,而是用来煮汤。
首页
|
新闻
|
话题
|
博客
|
相册
|
艺术作品
|
社交关系
|
留言板
|
社交圈
2005/09/14 | WebBrows仿造Cookie
类别(语言类学习笔记)
|
评论
(0)
|
阅读(350)
|
发表于 00:36
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, SHDocVw, mshtml, ExtCtrls, ComCtrls,
WinSkinData;
type
TForm1 = class(TForm)
SkinData1: TSkinData;
Edit1: TEdit;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
CheckBox1: TCheckBox;
Panel1: TPanel;
StatusBar1: TStatusBar;
WebBrowser1: TWebBrowser;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure WebBrowser1DownloadComplete(Sender: TObject);
procedure WebBrowser1StatusTextChange(Sender: TObject;
const Text: WideString);
procedure WebBrowser1TitleChange(Sender: TObject;
const Text: WideString);
procedure WebBrowser1BeforeNavigate2(Sender: TObject;
const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
Headers: OleVariant; var Cancel: WordBool);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure CheckBox1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
s:IHTMLdocument2;
begin
if checkbox1.Checked then
begin
s:=webbrowser1.document as IHTMLdocument2;
s.cookie :=memo1.Text ; //αÔìCookie
webbrowser1.Navigate(edit1.Text);
end
else
webbrowser1.Navigate(edit1.Text);
end;
procedure TForm1.WebBrowser1DownloadComplete(Sender: TObject);
var
s:IHTMLdocument2;
begin
if not checkbox1.Checked then
begin
s:=webbrowser1.document as IHTMLdocument2;
memo1.Text :=s.cookie ; //È¡µÃCookie
checkbox1.Enabled :=true;
end;
end;
procedure TForm1.WebBrowser1StatusTextChange(Sender: TObject;
const Text: WideString);
begin
statusbar1.Panels[1].Text :=text; //״̬ÌõÄÚÈÝ
end;
procedure TForm1.WebBrowser1TitleChange(Sender: TObject;
const Text: WideString);
begin
form1.Caption :=text+' ¡ª KendyBrowser'; //±êÌâ
end;
procedure TForm1.WebBrowser1BeforeNavigate2(Sender: TObject;
const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
Headers: OleVariant; var Cancel: WordBool);
begin
edit1.Text :=url; //µØÖ·À¸
end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
var
s:IHTMLdocument2;
begin
if key=#13 then
begin
if checkbox1.Checked then
begin
s:=webbrowser1.document as IHTMLdocument2;
s.cookie :=memo1.Text ;
webbrowser1.Navigate(edit1.Text);
end
else
webbrowser1.Navigate(edit1.Text);
end;
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
if memo1.ReadOnly then
memo1.ReadOnly :=false
else
memo1.ReadOnly :=true;
end;
end.
0
评论
Comments
日志分类
首页
[289]
教程习题
[21]
数据库学习笔记
[60]
语言类学习笔记
[75]
网页类学习笔记
[93]
其他相关笔记
[40]