Page 3 of 3

Re: Second instance of .exe fails

Posted: Thu Jan 23, 2025 1:31 pm
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.

Re: Second instance of .exe fails

Posted: Thu Jan 23, 2025 5:47 pm
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.