delphi 取得IE下面输入框内容


本文整理自网络,侵删。

 

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ShellAPI, SHDocVw, mshtml;

type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
ShellExecute(Handle, 'open', 'http://www.j7j8.com/', nil, nil, SW_ShowNormal);
end;

procedure TForm1.Button2Click(Sender: TObject);
var
ShellWindow: IShellWindows;
nCount: integer;
spDisp: IDispatch;
i: integer;
vi: OleVariant;
IE1: IWebBrowser2;
IDoc1: IHTMLDocument2;
begin
ShellWindow := CoShellWindows.Create;
nCount := ShellWindow.Count;

for i := 0 to nCount - 1 do
begin
vi := i;
spDisp := ShellWindow.Item(vi);
spDisp.QueryInterface( iWebBrowser2, IE1 );
if IE1 <> nil then
begin
memo1.Lines.Add( 'Location: '+ie1.LocationName );

IE1.Document.QueryInterface(IHTMLDocument2,iDoc1);
if iDoc1 <> nil then
begin
memo1.Lines.add( 'Title: ' + IDOC1.Title );
memo1.Lines.add( 'Url: ' + IDOC1.url);
end;
end;
end;
end;

end.

相关阅读 >>

Delphi memo1自动循环上下滚屏

Delphi readprocessmemory writeprocessmemory读写内存

Delphi shgetfileinfo函数

android实例-拍摄和分享照片、分享文本(xe8+小米2)

Delphi 同时激活两个窗体

Delphi 十进制十六进制转换

Delphi 枚举消息钩子的代码

Delphi pagecontrol不显示tab方式

Delphi中如何设置更改编译生成的exe文件的保存位置

Delphi设置光标在edit右边

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



打赏

取消

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

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

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

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

评论

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