在运行时使用Delphi创建TWebBrowser [英] Creating TWebBrowser in Runtime with Delphi

查看:71
本文介绍了在运行时使用Delphi创建TWebBrowser的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个TWebBrowser对象,该对象在运行时创建并在后台使用,即不可见.问题是在Delphi2009中,诸如OnDocumentComplete之类的事件不起作用或未触发.有什么建议吗?

I have a TWebBrowser object which is created in runtime and used in background, that is, not visible. The problem is that events like OnDocumentComplete dont work or are not triggered in Delphi2009. Any advice?

procedure TfrmMain.FormCreate(Sender: TObject);
begin
  FWebBrowser:= TWebBrowser.Create(Self);
  FWebBrowser.RegisterAsBrowser:= True;
  FWebBrowser.OnDocumentComplete:= WhenDocIsCompleted;
end;

procedure TfrmMain.WhenDocIsCompleted(ASender: TObject; const pDisp: IDispatch;
  var URL: OleVariant);
begin
  ShowMessage('Doc is completed!');
end;

Navigate和Navigate2之间有什么重要区别?如何在此处启用Cookie?

There is any difference important between Navigate and Navigate2? How can I enable cookies here?

谢谢.

推荐答案

TWinControl(FWebBrowser).Parent := Form1;  // Parent property is read-only unless cast

这篇关于在运行时使用Delphi创建TWebBrowser的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆