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.
chromium:=Tchromium.Create(nil);
chromium.DefaultUrl:=url;
if not chromium.Initialized then Chromium.CreateBrowser(nil, '');
while True do begin
if (chromium.Initialized) then Break;
Application.ProcessMessages();
end;
chromium.LoadURL(url);
chromium.Destroy //NOT WORK
chomium.free //NOT WORK
chromium.CloseBrowser(true); //NOT WORK
Freeandnil(chromium); //NOT WORK
chrom.CloseAllBrowsers; //NOT WORK
Use the code in one of the demos as a template for your application.
CEF and Chromium require creating and destroying the browsers following certain steps that are described and implemented in the demos.
Read this document :
https://www.briskbard.com/index.php?lang=en&pageid=cef
Use the code in the SimpleBrowser2 demo in case your application uses VCL.
Avoid using Application.ProcessMessages and waiting loops because they only cause problems with CEF.
Make sure your application has all the code from the demo that you decided to use as a template.
If CEF_DESTROY doesn't work it means that some code wasn't copied to your app.
var
chrom:Tchromium;
aAction : TCefCloseBrowserAction;
begin
chrom:=Tchromium.Create(nil);
chrom.OnBeforeResourceLoad:=Chromium1BeforeResourceLoad;
chrom.OnLoadingStateChange:=Chromium1LoadingStateChange;
chrom.DefaultUrl:=url;
if not chrom.Initialized then Chrom.CreateBrowser(nil,'');
while True do begin
if (chrom.Initialized) then Break;
Application.ProcessMessages();
end;
chrom.Browser.MainFrame.GetSourceProc(StringVisitor);
end;
aAction := cbaDelay;
PostMessage(Handle, WM_CLOSE, 0, 0);
PostMessage(handle, CEF_DESTROY, 0, 0);
I did everything according to the demonstration, it does not work how to be, write the code how long is it right for you chtoli I came here that I came to the battle of psychics
salvadordf wrote: Sat Oct 30, 2021 10:19 am
That's not the destruction sequence described in the demos. Please, read my previous comments in this thread.
Ok, I still don't know how to close and release the dynamically created browser.
I'm waiting for a decision from you
Uefi1 wrote: Tue Nov 16, 2021 3:20 am
Ok, I still don't know how to close and release the dynamically created browser.
I'm waiting for a decision from you
My previous answer is still the right one :
salvadordf wrote: Wed Oct 27, 2021 8:55 am
Use the code in one of the demos as a template for your application.
CEF and Chromium require creating and destroying the browsers following certain steps that are described and implemented in the demos.
Read this document :
https://www.briskbard.com/index.php?lang=en&pageid=cef
Use the code in the SimpleBrowser2 demo in case your application uses VCL.
Avoid using Application.ProcessMessages and waiting loops because they only cause problems with CEF.
If you need to create and destroy multiple browsers in your application you should use the code TabbedBrowser2, ToolBoxBrowser or MDIBrowser demos.
Use any of those demos as the foundation for your application and build the rest on top of that code.