Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.
Hello, please tell me how to create a browser dynamically the window cefwindowparent1 is empty
also can not get url
memo1.Lines.Add(chrom.Browser.MainFrame.Url);
Error Access Violation
I need to use a browser in a multithreaded application, so I just need to create the load page every time get the current url to destroy the component.
Last edited by Uefi1 on Wed Aug 25, 2021 7:44 am, edited 1 time in total.
I'm sorry but I only have a Delphi 10.4.2 license and that demo works with the latest version of Delphi.
If you have an older version of Delphi then you have to modify the code for yourself.
You can also install Lazarus to run this equivalent demo : CEF4Delphi/demos/Lazarus_Windows/WebpageSnapshot
var
chrom:Tchromium;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if Chrom.CreateBrowser(CEFWindowParent1)and (Chrom.Initialized) then
timer1.Enabled:=false;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chrom:=Tchromium.Create(cefwindowparent1);
timer1.Enabled:=true;
chrom.LoadURL('https://yandex.ru');
end;
procedure TForm1.Button1Click(Sender: TObject);
var
chrom:Tchromium;
begin
chrom:=Tchromium.Create(cefwindowparent1);
chrom.DefaultUrl:='https://yandex.ru';
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.UserAgent:='Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0';
if not Chrom.Initialized then Chrom.CreateBrowser(cefwindowparent1);
end;