Delphi利用Webbrowser登陆QQ群文档


本文整理自网络,侵删。

 
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实现win10下Delphi 10.3.1 inline hook 调试器法获取寄存器并修改

Delphi 检测程序有没有被dll注入的代码

Delphi 从twebbrowser webbrowser得到全部html源码

Delphi图像细化处理

Delphi http json 验证token

Delphi 串口 字符串转换ascii

Delphi 防止程序重复打开运行

Delphi tdownloadurl下载网络文件

Delphi 数组与枚举

Delphi对cookie的操作

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



打赏

取消

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

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

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

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

评论

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