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.

Second instance of .exe fails

alexdv
Posts: 1
Joined: Thu Jan 23, 2025 1:19 pm

Re: Second instance of .exe fails

Post by alexdv »

Hello, salvadorf!

Could you please clarify your
If you need to use the same cache and cookies in all your instances then follow the instructions about using a MUTEX in my previous posts on this thread.
I'm developing an application that can be run several times simultaneously. And after the CEF was updated it is impossible. Chromium is not the main feature of the application. But it is sometimes used for showing some web content. So the question is: is it possible to share one Chromium (CEF) instance between several apps?

Thanks in advance.
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Second instance of .exe fails

Post by salvadordf »

Hi,

If each application instance uses a different GlobalCEFApp.RootCache value then you can run several instances of your application without problems.
Having a different GlobalCEFApp.RootCache value means that the cache and cookies will be independent.

However, if you need to share the same browser cache and cookies then the application needs to be modified.

In this case you would need to implement GlobalCEFApp.OnAlreadyRunningAppRelaunch as you can see in the TabbedBrowser2 demo :
https://github.com/salvadordf/CEF4Delphi/blob/f0f4de8b3b5e69d0b9353a374093959712c56bb2/demos/Delphi_VCL/TabbedBrowser2/uMainForm.pas#L155

The TabbedBrowser2 demo uses that event to create a new browser tab every time another application with the same GlobalCEFApp.RootCache value tries to run at the same time.

If a web browser is not the main feature in your application you can also have a hidden main form with an icon in the tray bar and create a new child form each time a user tries to run your application.
Post Reply