unit Unit1;

interface

uses

Winapi.Windows,Winapi.Messages,System.SysUtils,System.Variants,System.Classes,Vcl.Graphics,

Vcl.Controls,Vcl.Forms,Vcl.Dialogs,Vcl.OleCtrls,SHDocVw,Vcl.StdCtrls;

type

TForm1=class(TForm)

Edit1:TEdit;

Button1:TButton;

WebBrowser1:TWebBrowser;

procedure Button1Click(Sender:TObject);

procedure WebBrowser1NewWindow3(ASender:TObject;var ppDisp:IDispatch;

var Cancel:WordBool;dwFlags:Cardinal;const bstrUrlContext,bstrUrl:WideString);

private

{Private declarations}

public

{Public declarations}

end;

var

Form1:TForm1;

implementation

{$R*.dfm}

procedure TForm1.Button1Click(Sender:TObject);

begin

WebBrowser1.Navigate(Edit1.text);

end;

procedure TForm1.WebBrowser1NewWindow3(ASender:TObject;var ppDisp:IDispatch;

var Cancel:WordBool;dwFlags:Cardinal;const bstrUrlContext,bstrUrl:WideString);

begin

Cancel:=True;

TWebBrowser(ASender).Navigate(bstrUrl);

WebBrowser1.Silent:=True;

edit1.Text:=bstrUrl;

end;

end.

DELPHI 10.3 浏览器
DELPHI 10.3 浏览器
DELPHI 10.3 浏览器

为什么一定要是 WebBrowser1NewWindow3 呢 ?

相关文章:

  • 2021-11-23
  • 2021-08-11
  • 2021-12-02
  • 2022-02-11
猜你喜欢
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-02
  • 2021-12-12
相关资源
相似解决方案