Check libs before StartMainProcess

Post Reply
Lingri
Posts: 4
Joined: Tue Dec 08, 2020 7:21 am

Check libs before StartMainProcess

Post by Lingri »

Hello!
Case: in our program libs can be not exists on computer. In this case there are downloading libs from ftp, and then starting Chromium.

In CEF, when executing GlobalCEFApp.StartMainProcess without libs, we catching error 'CEF libraries is missing'.
In documenation, StartMainProcess must be called only on .dpr before Application.Initialize.

How we can call StartMainProcess after special event in our program, for example - on button click? We dont have necessary have necessity to store CEF libraries for each copy of our program, only when the user need it.
User avatar
salvadordf
Posts: 2966
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Check libs before StartMainProcess

Post by salvadordf »

Hi,

Use a different EXE for the subprocesses and call GlobalCEFApp.StartMainProcess after your application has checked and downloaded the libraries.

You can use these functions in uCEFMiscFunctions.pas to check the CEF libraries manually :
  • CheckSubprocessPath
  • CheckLocales
  • CheckResources
  • CheckDLLs
You can see how to use those functions here :
https://github.com/salvadordf/CEF4Delph ... e.pas#L957
Lingri
Posts: 4
Joined: Tue Dec 08, 2020 7:21 am

Re: Check libs before StartMainProcess

Post by Lingri »

"Use a different EXE for the subprocesses and call GlobalCEFApp.StartMainProcess after your application"
Is there some example? Is it mean I dont can use it in one EXE?

i.e. I have a frame, which opened in my application from menu. In this frame I have a CEFWindowParent, on which I show info from website. All of this must be in one window, but when I open frame - should be execute checking libs, downloading and creating browser on frame. Is it possible?
User avatar
salvadordf
Posts: 2966
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Check libs before StartMainProcess

Post by salvadordf »

Sorry for the long delay.

If your application starts running, then checks the CEF libraries and downloads the libraries then you need to initialize CEF after the libraries are downloaded and decompressed.

In that case you need to configure GlobalCEFApp to use another EXE when Chromium needs to create another process.

There are several demos using this setting. Take a look at the "SubProcess" demo for more details.
Post Reply