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.

Resource File not loading From DLL

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

Re: Resource File not loading From DLL

Post by salvadordf »

Hi,

Set a break point in that procedure to see where is the exception exactly.

The TChromium.OnGetResourceHandler event is called in a CEF3 thread and perhaps that's the cause of the exception loading a DLL and reading resources from it.

Try loading the DLL in the main thread and then read the resources from TChromium.OnGetResourceHandler. I haven't checked the Delphi TResourceStream's source code but if it's not thread safe I would also add a critical section or mutex to that event.
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Resource File not loading From DLL

Post by salvadordf »

Move the LoadLibrary call to the TForm.OnShow event but leave the rest of the code that reads the resources in the TChromium.OnGetResourceHandler event.

Delphi uses unicode by default. I would suggest you to convert the text resources to UTF8 and add a <meta charset="UTF-8"> tag to the HEAD section in your HTML.

Use these functions :
http://docwiki.embarcadero.com/RADStudi ... n_Routines
Post Reply