zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    C#基础知识——类的继承
    值传递与引用传递01
    今天接到任务了!
    傅立叶变换,时域,频域二
    傅立叶变换,时域,频域一
    常用运放选型一览表
    用三段140字符以内的代码生成一张1024×1024的图片
    [收藏夹整理]电子类链接
    [收藏夹整理]三维重构部分
    MSP430之自动增益程控放大main备份
  • 原文地址:https://www.cnblogs.com/findumars/p/4998877.html
Copyright © 2011-2022 走看看