TChromium出现在LoadURL上的错误 [英] Error on LoadURL with TChromium
问题描述
我发现了一个出色的 Delphi Chromium 项目,该项目可以将Chrome以Delphi形式嵌入。经过一番黑客之后,它在Delphi7中运行良好,并且可以运行演示应用程序。
I found the brilliant Delphi Chromium project for embedding Chrome in a Delphi form. It works well in Delphi7 after a bit of hacking and I can get the demo app running.
但是,当我使用该组件开发自己的应用程序时,无法加载我自己的网址。我遇到访问冲突。
However when I do my own app with the component, I can't load my own url. I get a access violation.
Chromium2.Browser.MainFrame.LoadUrl('http://www.example.com');
TChrromium组件正在运行,并且所有DLL都位于正确的位置,因为如果我将 DefaultUrl
可以正常工作。
The TChromium component is working and I have all the DLLs in the right place, since if I set DefaultUrl
it works fine.
我在TPageControl页面中有Chromium2,并通过按钮的OnClick事件调用了以上代码。我得到一个AccessViolation。大型机是 nil
。
I have Chromium2 in a TPageControl page and with the OnClick event of a button I call the above code. I get an AccessViolation. Mainframe is nil
.
我找不到解决办法,有人能解决这个问题吗? / p>
I can't find a way around this, has anyone got this to work?
推荐答案
我仍然没有找到解决方法,但发现以下解决方法
I still haven't found a resolution but I found the following work around
procedure TForm1.lblWebsiteClick(Sender: TObject);
var MainFrame : ICefFrame;
begin
MainFrame := Chromium2.Browser.GetMainFrame;
MainFrame.LoadUrl('http://www.cookingisfun.ie');
end;
这篇关于TChromium出现在LoadURL上的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!