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.

How to access mainprocess of host-app - from my DLL

Post Reply
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to access mainprocess of host-app - from my DLL

Post by salvadordf »

Hi,

CEF3 can only be initialized once per process and that can be a problem if you develop plugins or DLLs for other applications that already use CEF3.
CEF4Delphi initializes CEF3 in the GlobalCEFApp.StartMainProcess function.

If the host application is already using CEF3 then you can show the web contents from a different process following these steps :
  • Create a standalone application that shows the web contents. Let's call this application "CefBrowser" and use GlobalCEFApp.StartMainProcess normally because this application will be in a different process.
  • Create the Extension-DLL but it will only execute "CefBrowser" using ShellExecute or ShellExecuteEx.
If you need some kind of communication between the Extension-DLL and CefBrowser then you can use any form of "Inter process communication" available : named pipes, websockets, etc...

If you decide to use websockets you can try TCEFServerComponent. Take a look at the SimpleServer demo.
Post Reply