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.
Retrun JS result Tchromium
Re: Retrun JS result Tchromium
Thanks a lot for your reply.
Please let me know when the event OnWebKitInitialized is triggered.
Thanks
Please let me know when the event OnWebKitInitialized is triggered.
Thanks
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Retrun JS result Tchromium
As you can see in the documentation, that event is executed in the render process.
Read this to know how to debug code in multiple processes :
https://www.briskbard.com/index.php?lang=en&pageid=cef#debugging
Read this to know how to debug code in multiple processes :
https://www.briskbard.com/index.php?lang=en&pageid=cef#debugging
Re: Retrun JS result Tchromium
Thanks for your reply.
In the JS example, CreateGlobalCEFApp; is called in the program file.
In my case I am using a dll (run time package) and need to know where to call CreateGlobalCEFApp.
I tried to call this with in a class of the package. However if gives exception when accessing it for the second time (GlobalCEFApp.StartMainProcess; is called again). Please help
In the JS example, CreateGlobalCEFApp; is called in the program file.
In my case I am using a dll (run time package) and need to know where to call CreateGlobalCEFApp.
I tried to call this with in a class of the package. However if gives exception when accessing it for the second time (GlobalCEFApp.StartMainProcess; is called again). Please help
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Retrun JS result Tchromium
CEF can only be initialized once per process.
Export 2 functions to initialize and finalize GlobalCEFApp. See the DLLBrowser demo.
Export 2 functions to initialize and finalize GlobalCEFApp. See the DLLBrowser demo.
Re: Retrun JS result Tchromium
Thanks for your reply.
IN my application I am using dll( runtime package). I created GlobalCEFApp in initialization section of a unit file of the library. Also called GlobalCEFApp.StartMainProcess; (without insde if statement) after creation of GlobalCEFApp. In finalization called DestroyGlobalCEFApp. However the code
TempJSCode := 'var testhtml = document.getElementById(' + quotedstr('ctl00_processingRequestPanel') +
'.innerHTML; ' + 'myextension.sendresulttobrowser(testhtml, ' + quotedstr(HTMLDOMELEMENT_MESSAGE_NAME) + ');';
fBrowser.ExecuteJavaScript(TempJSCode, 'about:blank', 0);
is not executing and the onprocessmessagerecived event is not invoking. Could you please help.
Thank you
IN my application I am using dll( runtime package). I created GlobalCEFApp in initialization section of a unit file of the library. Also called GlobalCEFApp.StartMainProcess; (without insde if statement) after creation of GlobalCEFApp. In finalization called DestroyGlobalCEFApp. However the code
TempJSCode := 'var testhtml = document.getElementById(' + quotedstr('ctl00_processingRequestPanel') +
'.innerHTML; ' + 'myextension.sendresulttobrowser(testhtml, ' + quotedstr(HTMLDOMELEMENT_MESSAGE_NAME) + ');';
fBrowser.ExecuteJavaScript(TempJSCode, 'about:blank', 0);
is not executing and the onprocessmessagerecived event is not invoking. Could you please help.
Thank you
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Retrun JS result Tchromium
https://github.com/salvadordf/CEF4Delphi/blob/66279dde4269ac4360d3475d1dd55fd56cc77c89/demos/Delphi_VCL/DLLBrowser/DLLBrowser.dpr#L31
Code: Select all
// CEF3 needs to be initialized and finalized outside the DLL's initialization and
// finalization sections. For this reason, you need to call InitializeCEF4Delphi
// after you load this DLL and you also need to call FinalizeCEF4Delphi before
// unloading this DLL.
Re: Retrun JS result Tchromium
Thanks for your reply.
I am using a runtime dll.
When I call procedure InitializeCEF4Delphi; stdcall; external 'XX.dll';, If fails to load the runtime dll when opening the IDE.
I am using a runtime dll.
When I call procedure InitializeCEF4Delphi; stdcall; external 'XX.dll';, If fails to load the runtime dll when opening the IDE.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Retrun JS result Tchromium
Try loading the DLL with LoadLibrary and then use GetProcAddress for the functions.
CEF4Delphi, WebView4Delphi and WebUI4Delphi use those functions to avoid that issue.
CEF4Delphi, WebView4Delphi and WebUI4Delphi use those functions to avoid that issue.
Re: Retrun JS result Tchromium
Thanks for your reply. Just to know can't I implement InitializeCEF4Delphi and FinalizeCEF4Delphi with in the same dll. In my application I am using 2 different dlls. Can I implement these functions in one dll?
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Retrun JS result Tchromium
It's only allowed to initialize CEF once per process. There's no workaround for this feature.
Using DLLs to embed a browser is complicated because it's not possible to access variables or data between the main application and the code inside the DLL directly. Having multiple DLLs complicates things even more.
Using DLLs to embed a browser is complicated because it's not possible to access variables or data between the main application and the code inside the DLL directly. Having multiple DLLs complicates things even more.