Page 1 of 1

Check libs before StartMainProcess

Posted: Wed Dec 09, 2020 8:57 am
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.

Re: Check libs before StartMainProcess

Posted: Wed Dec 09, 2020 11:49 am
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

Re: Check libs before StartMainProcess

Posted: Wed Dec 09, 2020 12:12 pm
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?

Re: Check libs before StartMainProcess

Posted: Tue Dec 15, 2020 9:43 pm
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.