Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
977 views
in Technique[技术] by (71.8m points)

delphi - Error on LoadURL with TChromium

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');

The TChromium component is working and I have all the DLLs in the right place, since if I set DefaultUrl it works fine.

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.

I can't find a way around this, has anyone got this to work?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...