A
adrich
Unregistered / Unconfirmed
GUEST, unregistred user!
我在程序中动态生成了一个wb:TWebbrowser的变量,运行时怎么没有触发它的事件。
大家帮忙看看
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, ExtCtrls;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
var
wb:Twebbrowser;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
aPanel:TPanel;
begin
apanel:=Tpanel.Create(self);
apanel.Parent:=self;
wb:=Twebbrowser.Create(self);
aPanel.InsertControl(wb);
wb.OnDocumentComplete:=WebBrowser1DocumentComplete;
wb.Navigate('http://www.delphibbs.com/');
wb.Free;
wb:=nil;
application.MessageBox(pchar('end.'),'',0)
end;
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
application.MessageBox(pchar('ok'),'',0)
end;
end.
大家帮忙看看
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, ExtCtrls;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
var
wb:Twebbrowser;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
aPanel:TPanel;
begin
apanel:=Tpanel.Create(self);
apanel.Parent:=self;
wb:=Twebbrowser.Create(self);
aPanel.InsertControl(wb);
wb.OnDocumentComplete:=WebBrowser1DocumentComplete;
wb.Navigate('http://www.delphibbs.com/');
wb.Free;
wb:=nil;
application.MessageBox(pchar('end.'),'',0)
end;
procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject;
const pDisp: IDispatch; var URL: OleVariant);
begin
application.MessageBox(pchar('ok'),'',0)
end;
end.