Delphi利用Webbrowser登陆QQ群文档
2015-11-26 20:45
399 查看
unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, IEBrowser, Mshtml; type TForm1 = class(TForm) Label1: TLabel; Edit1: TEdit; Label2: TLabel; Edit2: TEdit; Button1: TButton; Web: TCppWebBrowser; procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var Doc: IHTMLDocument2; UserInputElement, PwdInputElement: IhtmlInputElement; SwitchElement, SubmitElement: IhtmlElement; begin Doc := Web.Document as IHTMLDocument2; UserInputElement := (Doc.all.item('u', 0) as IHtmlInputElement); userInputElement.value := trim(Edit1.Text); PwdInputElement := (Doc.all.item('p', 0) as IHtmlInputElement); PwdInputElement.value := trim(Edit2.Text); Sleep(1000); SubmitElement := (Doc.all.item('login_button', 0) as IHtmlElement); SubmitElement.click; end; procedure TForm1.FormCreate(Sender: TObject); begin Web.Navigate('http://ui.ptlogin2.qq.com/cgi-bin/login?appid=549000912&s_url=http://qun.qzone.qq.com/group&style=11'); end; end.
PS:这里的TCppWebBrowser是我从新导出ShDocVW.dll后,在此基础上修改而来的,如果要测试,可以用Delphi自带的Webbrowser替代即可!
http://www.lsworks.net/article/98.html
相关文章推荐
- Delphi在Webbrowser上绘制图像
- 内存共享【Delphi版】
- Delphi十进制和十六进制互转
- Delphi Help
- Delphi反汇编内部字符串处理函数不完全列表
- delphi 数据连接规范
- Delphi New,Getmem,ReallocMem联系与区别
- 去掉delphi XE8或者更高版本编辑器自带的begin end之间的线条
- RAD Studio, Delphi, C++Builder限时年终优惠活动
- Delphi中使用Office中VBA的优缺点
- Delphi中控制VBA 宏
- Delphi 与 Word_VBA
- Delphi中如何调用Excel VBA
- 201601 DELPHI_强制类型转换As
- Delphi 10 Seattle FireDAC 连接池配置过程
- Delphi 技巧改造HINT的输出方式
- delphi中需要熟悉的知识点
- Delphi 常用API 函数(好多都没见过)
- delphi7调用JAVA RESTFUL接口
- Delphi 更改文件时间