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中提取网址链接分路径

Delphi编写系统服务

Delphi 判断正在运行的设备是iphone还是ipad

Delphi 检查程序是否在(vm,vpc等)虚拟机运行 Delphi(测试可用)

Delphi idhttp下载html的代码(含错误处理)

idhttpserver允许跨域访问

Delphi查找特定的exe是否在运行

Delphi 安卓 app 动态权限申请

Delphi 的字符及字符串 - char、ansichar、widechar、pchar、pansichar、pwidechar

Delphi android 平台加载文件

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



打赏

取消

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

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

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

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

评论

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