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.

SendProcessMessage to Main Process doesn't work

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

Re: SendProcessMessage to Main Process doesn't work

Post by salvadordf »

I uploaded a new version of the JSExtensionWithFunction demo.

This demo registers an extension that is triggered when the user clicks a button from a local html file.
Now it also sends a text message back to the main process and it's shown in the status bar.
Albus

Re: SendProcessMessage to Main Process doesn't work

Post by Albus »

I think I found the problem. The ProcessMessage is recieved by the TChomium.OnProcessMessageReceived event handler. But I'm trying to recieve the ProcessMessage with the GlobalCEFApp.OnProcessMessageReceived event handler, and this event handler doesn't recieve anything.
But because of the design of my application it would be very good if i can use the GlobalCEFApp.OnProcessMessageReceived event handler and not the TChomium.OnProcessMessageReceived event handler. Is it a bug that the global event handler doesn't recieve anything?

Btw: In the JSExtensionWithFunction example is no html file which could be loaded ;)
User avatar
salvadordf
Posts: 4057
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: SendProcessMessage to Main Process doesn't work

Post by salvadordf »

GlobalCEFApp.OnProcessMessageReceived receives messages in the render process only because it exposes the TCefCustomRenderProcessHandler.OnProcessMessageReceived event.

TChomium.OnProcessMessageReceived receives messages in the browser process only because it exposes the TCustomClientHandler.OnProcessMessageReceived event.

This is the CEF3 design but you can implement your own custom Inter-Process Communication (IPC) messages in addition to the CEF3 process messages.

Some users reported that the Delphi 10.2 project files that I upload to GitHub are not fully compatible with older Delphi versions and sometimes the output directory is ignored. Please, move the EXE to the bin directory or modify the project manually.
Albus

Re: SendProcessMessage to Main Process doesn't work

Post by Albus »

Ok, I now made a little workaround for this so it works mostly fine.

But after I got this working I had another issue, but I'm going to open a new topic for this.
Post Reply