Delphi webbrowser获取页面全部链接


本文整理自网络,侵删。

 unit Unit1;

interface

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

type
TForm1 = class(TForm)
WebBrowser1: TWebBrowser;
Button1: TButton;
Edit1: TEdit;
ListBox1: TListBox;
procedure Button1Click(Sender: TObject);
procedure WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
i: Integer;
begin


webbrowser1.Navigate(edit1.Text);

end;

procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
var
i:integer;
begin
for i := 0 to Webbrowser1.OleObject.Document.links.Length - 1 do
Listbox1.Items.Add(Webbrowser1.OleObject.Document.Links.Item(i));
end;

end.

相关阅读 >>

Delphi 2010下使用sqlitesimpleDelphi连接sqlite数据库及中文乱码问题的解决

Delphi检测当前鼠标点击处是否在指定控件内部

Delphi xe安装 tclientsocket, tserversocket控件

Delphi xe 获取 android application version 版本

Delphi self-delete程序

Delphi中对excel表格文件的导入和导出操作

Delphi indy tidhttp tidhttpserver post get

Delphi 10.3 开发app 在android手机上获取imei

Delphi 多线程 开始、暂停、继续、停止

Delphi 利用tidhttp实现文件下载的分块断点续传

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



打赏

取消

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

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

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

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

评论

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