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.

How to create and destroy browser form?

andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

How to create and destroy browser form?

Post by andreykrasnodar »

Hello.
I have 2 forms in a project. Main form contains a lot of buttons and functions. The second form contains TChromium component.
A button on the main form should show (create/activate) 2nd form with TChromium, make some action and close (hide/destroy) form with TChromium after everything is done or timeout and free memory.
The next time the button should create form once again. And again and again.
I am not able to do it myself. Demos did not make it clear. Please help me.
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to create and destroy browser form?

Post by salvadordf »

Use the code in the ToolboxBrowser demo.
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: How to create and destroy browser form?

Post by andreykrasnodar »

I use old version - 'Delphi Chromium Embeded 3'. I found ToolBoxBrowser on github.

CreateGlobalCEFApp;
if GlobalCEFApp.StartMainProcess then
begin
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end;
DestroyGlobalCEFApp;
There is an error Unit uCEFApplication not found
Last edited by andreykrasnodar on Fri Jul 03, 2020 9:53 am, edited 1 time in total.
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to create and destroy browser form?

Post by salvadordf »

Check that CEF4Delphi's source directory is in the Delphi's library path :
https://www.briskbard.com/index.php?lan ... stallation
https://github.com/salvadordf/CEF4Delph ... -in-Delphi
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: How to create and destroy browser form?

Post by andreykrasnodar »

salvadordf wrote: Fri Jul 03, 2020 9:47 am Check that CEF4Delphi's source directory is in the Delphi's library path :
https://www.briskbard.com/index.php?lan ... stallation
https://github.com/salvadordf/CEF4Delph ... -in-Delphi
Of course it is in the Delphi's library path. But there is no uCEFApplication in it
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to create and destroy browser form?

Post by salvadordf »

You should have this file in the "CEF4Delphi\source" directory :
https://github.com/salvadordf/CEF4Delph ... cation.pas

"CEF4Delphi\source" should also be added to the library path for 32 bits projects and 64 bits projects in the Delphi configuration window.
This is a common issue in Delphi because the configuration window shows the library path for 64 bits projects by default and most of the demos have a 32 bit target by default.
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: How to create and destroy browser form?

Post by andreykrasnodar »

salvadordf wrote: Fri Jul 03, 2020 10:22 am You should have this file in the "CEF4Delphi\source" directory
But I use Cef 3 (old version) https://github.com/hgourvest/dcef3 . I need it to create project for Windows XP.
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: How to create and destroy browser form?

Post by andreykrasnodar »

I used simple code

Code: Select all

  Form1.Show;
  Form1.Delay(5000);// my own procedure like sleep(), but does not load processor
  form1.Chromium1.Load('yandex.ru');
  Form1.Delay(100000);
  form1.Chromium1.Load('about:blank');
  Form1.Delay(10000);
  Application.Terminate;
But after terminating the application it is still in task manager and eats my memory.
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to create and destroy browser form?

Post by salvadordf »

I'm sorry I missed that.

Consider using OldCEF4Delphi if you need to support Windows XP :
https://github.com/salvadordf/OldCEF4Delphi

It also has a ToolboxBrowser demo.
andreykrasnodar
Posts: 112
Joined: Wed Jul 01, 2020 10:22 am

Re: How to create and destroy browser form?

Post by andreykrasnodar »

salvadordf wrote: Fri Jul 03, 2020 10:58 am I'm sorry I missed that.

Consider using OldCEF4Delphi if you need to support Windows XP :
https://github.com/salvadordf/OldCEF4Delphi

It also has a ToolboxBrowser demo.
Thanks. But... can I do that with cef3?
Post Reply