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?
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;