Recent

Author Topic: [solved] CEF for dummies - where to name the path?  (Read 697 times)

Nicole

  • Hero Member
  • *****
  • Posts: 1271
[solved] CEF for dummies - where to name the path?
« on: October 03, 2025, 03:56:10 pm »
Solution is here:
https://forum.lazarus.freepascal.org/index.php/topic,72468.0.html

===============

For those, who should not know it:
CEF4Delphi is a wrapper for CEF, which allows configuring an internet-browser.

Pawel proved that is runs with Win 7 still.
I tried to install the CEF, but fail to run the demo.
It gives me a looong list of error-messages of missing files. These files were in the download-linked by Pawel and they are on my PC. However they are said missing.

What I tried (in version 4.2., which will be reverted):
- I set in paths of the project to the directory, did not help
- I copied the files directly in the project's root (how ugly!). Did not help neither.

How to say Lazarus, where to find those files?
I will go back to version 4.0. now, so I will try the solution there.
« Last Edit: October 13, 2025, 10:11:20 am by Nicole »

salvadordf

  • Jr. Member
  • **
  • Posts: 68
    • BriskBard
Re: CEF for dummies - where to name the path?
« Reply #1 on: October 03, 2025, 04:27:20 pm »
The easiest way is to copy the binaries in the same directory as the executable as you can see in the attachment.

The SimpleBrowser2 demo shows how to configure CEF to use the binaries in a different directory :
https://github.com/salvadordf/CEF4Delphi/blob/1a9acbacd9522d43adf8bcb318be2311fb00f0aa/demos/Delphi_VCL/SimpleBrowser2/SimpleBrowser2.dpr#L62

Read this document for more information :
https://www.briskbard.com/index.php?lang=en&pageid=cef#installation

« Last Edit: October 03, 2025, 04:29:05 pm by salvadordf »
Maintainer of the CEF4Delphi, WebView4Delphi, WebUI4Delphi and WebUI4CSharp projects

Nicole

  • Hero Member
  • *****
  • Posts: 1271
Re: CEF for dummies - where to name the path?
« Reply #2 on: October 03, 2025, 05:27:44 pm »
Thanks, for your answer.
Yes, this is how the files look here. These are the good news.

The directory-change is much more complex than expected. There is a suggestion for Delphi in your link, which is hard to me to understand. So I asked ChatGPT to write it for Lazarus 4.0 and this is what it said:

Code: Pascal  [Select][+][-]
  1. if GlobalCEFApp.StartMainProcess then
  2. begin
  3.   Application.Initialize;
  4.   {$IFDEF FPC}
  5.     {$IF (LCLVersion >= 4000000)}
  6.       Application.MainFormOnTaskbar := True;
  7.     {$ENDIF}
  8.   {$ELSE}
  9.     {$IFDEF DELPHI11_UP}
  10.       Application.MainFormOnTaskbar := True;
  11.     {$ENDIF}
  12.   {$ENDIF}
  13.   Application.CreateForm(TForm1, Form1);
  14.   Application.Run;
  15. end;
  16.  

As the nonsense quote of ChatGPT is between 70 to 80 percent, I am not sure, if this makes sense. Does it? Not sure, if this Delphi11_UP line is used or not.

And this goes to the create event of my form, correct?

Code: Pascal  [Select][+][-]
  1. begin
  2.   GlobalCEFApp := TCefApplication.Create;
  3.  
  4.   // In case you want to use custom directories for the CEF3 binaries, cache and user data.
  5.   // If you don't set a cache directory the browser will use in-memory cache.
  6. {
  7.   GlobalCEFApp.FrameworkDirPath     := 'c:\cef';
  8.   GlobalCEFApp.ResourcesDirPath     := 'c:\cef';
  9.   GlobalCEFApp.LocalesDirPath       := 'c:\cef\locales';
  10.   GlobalCEFApp.EnableGPU            := True;      // Enable hardware acceleration
  11.   GlobalCEFApp.cache                := 'c:\cef\cache';
  12.   GlobalCEFApp.UserDataPath         := 'c:\cef\User Data';
  13. }


Is there anywhere and anything to declare or to link in the "Form1"?
uses clauses, Var declaration...?
I have the demo with simple browser, it will become a frame. My frames are created and placed in the main-form ("form1").

Thaddy

  • Hero Member
  • *****
  • Posts: 18324
  • Here stood a man who saw the Elbe and jumped it.
Re: CEF for dummies - where to name the path?
« Reply #3 on: October 03, 2025, 05:58:52 pm »
I am missing the include file that accompanies this code.
The include file should define FPC like so:
Code: Pascal  [Select][+][-]
  1. // at the very top, spoof the Delphi version <--- important: very top, first
  2. {$IFDEF FPC}
  3. {$DEFINE VER200}// or highest available if lower or max {$VER220}, fpc trunk max {$VER240}
  4. {$ENDIF}
Then the rest of the code needs no further FPC specific defines at all.
It can be reduced in the pascal units to:
Code: Pascal  [Select][+][-]
  1. {$IFDEF DELPHI11_UP} // defined by VER200
  2. Application.MainFormOnTaskbar := True;
  3. {$ENDIF}
It looks like the versioning include from the jvcl is used and that one is wrong. Really wrong....
You need to keep all LCL CEF in Delphi mode, though.
Do not define Lazarus versions, just FPC. MainformOnTaskBar is just about the only exception and is covered.
All other defines in the code are just compiler capabilities.

« Last Edit: October 03, 2025, 06:08:20 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

salvadordf

  • Jr. Member
  • **
  • Posts: 68
    • BriskBard
Re: CEF for dummies - where to name the path?
« Reply #4 on: October 03, 2025, 06:24:51 pm »
The directory-change is much more complex than expected. There is a suggestion for Delphi in your link, which is hard to me to understand. So I asked ChatGPT to write it for Lazarus 4.0 and this is what it said:

This is the link to the same code in a Lazarus demo for Windows :
https://github.com/salvadordf/CEF4Delphi/blob/1a9acbacd9522d43adf8bcb318be2311fb00f0aa/demos/Lazarus_Windows/SimpleBrowser2/SimpleBrowser2.lpr#L22

And this goes to the create event of my form, correct?
Code: Pascal  [Select][+][-]
  1. begin
  2.   GlobalCEFApp := TCefApplication.Create;
  3.  
  4.   // In case you want to use custom directories for the CEF3 binaries, cache and user data.
  5.   // If you don't set a cache directory the browser will use in-memory cache.
  6. {
  7.   GlobalCEFApp.FrameworkDirPath     := 'c:\cef';
  8.   GlobalCEFApp.ResourcesDirPath     := 'c:\cef';
  9.   GlobalCEFApp.LocalesDirPath       := 'c:\cef\locales';
  10.   GlobalCEFApp.EnableGPU            := True;      // Enable hardware acceleration
  11.   GlobalCEFApp.cache                := 'c:\cef\cache';
  12.   GlobalCEFApp.UserDataPath         := 'c:\cef\User Data';
  13. }

The GlobalCEFApp properties must be set before the GlobalCEFApp.StartMainProcess call.

Is there anywhere and anything to declare or to link in the "Form1"?
uses clauses, Var declaration...?
I have the demo with simple browser, it will become a frame. My frames are created and placed in the main-form ("form1").

Use the code from the TabbedBrowser2 demo for Lazarus as a template for your application. It uses frames too :
https://github.com/salvadordf/CEF4Delphi/tree/1a9acbacd9522d43adf8bcb318be2311fb00f0aa/demos/Lazarus_Windows/TabbedBrowser2
« Last Edit: October 03, 2025, 06:26:44 pm by salvadordf »
Maintainer of the CEF4Delphi, WebView4Delphi, WebUI4Delphi and WebUI4CSharp projects

Thaddy

  • Hero Member
  • *****
  • Posts: 18324
  • Here stood a man who saw the Elbe and jumped it.
Re: CEF for dummies - where to name the path?
« Reply #5 on: October 03, 2025, 06:38:55 pm »
Yes, but still: WHAT DOES the missing include file say?????
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

salvadordf

  • Jr. Member
  • **
  • Posts: 68
    • BriskBard
« Last Edit: October 03, 2025, 07:11:45 pm by salvadordf »
Maintainer of the CEF4Delphi, WebView4Delphi, WebUI4Delphi and WebUI4CSharp projects

Thaddy

  • Hero Member
  • *****
  • Posts: 18324
  • Here stood a man who saw the Elbe and jumped it.
Re: CEF for dummies - where to name the path?
« Reply #7 on: October 03, 2025, 07:16:42 pm »
As I already suspected, that include file is wrong. I will post a probably repaired version in a few minutes.
Code: Pascal  [Select][+][-]
  1. // ************************************************************************
  2. // ***************************** CEF4Delphi *******************************
  3. // ************************************************************************
  4. //
  5. // CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
  6. // browser in Delphi applications.
  7. //
  8. // The original license of DCEF3 still applies to CEF4Delphi.
  9. //
  10. // For more information about CEF4Delphi visit :
  11. //         https://www.briskbard.com/index.php?lang=en&pageid=cef
  12. //
  13. //        Copyright © 2023 Salvador Diaz Fau. All rights reserved.
  14. //
  15. // ************************************************************************
  16. // ************ vvvv Original license and comments below vvvv *************
  17. // ************************************************************************
  18. (*
  19.  *                       Delphi Chromium Embedded 3
  20.  *
  21.  * Usage allowed under the restrictions of the Lesser GNU General Public License
  22.  * or alternatively the restrictions of the Mozilla Public License 1.1
  23.  *
  24.  * Software distributed under the License is distributed on an "AS IS" basis,
  25.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
  26.  * the specific language governing rights and limitations under the License.
  27.  *
  28.  * Unit owner : Henri Gourvest <hgourvest@gmail.com>
  29.  * Web site   : http://www.progdigy.com
  30.  * Repository : http://code.google.com/p/delphichromiumembedded/
  31.  * Group      : http://groups.google.com/group/delphichromiumembedded
  32.  *
  33.  * Embarcadero Technologies, Inc is not permitted to use or redistribute
  34.  * this source code without explicit permission.
  35.  *
  36.  * This version adapted by Thaddy de Koning to better suit Freepascal 2025.
  37.  *  be aware this is not the original.
  38.  *)
  39.  
  40.  // The complete list of compiler versions is here :
  41.  // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions
  42.  
  43. {$DEFINE DELPHI_VERSION_UNKNOW}
  44. // Delphi uses MACOS for the new MacOSX and DARWIN is not defined
  45. // FPC uses DARWIN for the new MacOSX and MACOS is defined for the classic Macintosh OS (System 7)
  46. // We define MACOSX to avoid conflicts in both situations
  47. {$IFDEF FPC}
  48.   {$IFDEF DARWIN}
  49.     {$DEFINE MACOSX}
  50.   {$ENDIF}
  51.   {$DEFINE VER180} // conservative. We spoof a Delphi version for the rest of the include. VER230 is known to work
  52. {$ELSE}
  53.   {$IFDEF MACOS}
  54.     {$DEFINE MACOSX}
  55.   {$ENDIF}
  56. {$ENDIF}
  57.  
  58. // Delphi 5
  59. {$IFDEF VER130}
  60.   {$UNDEF DELPHI_VERSION_UNKNOW}
  61.   {$DEFINE DELPHI5_UP}
  62. {$ENDIF}
  63.  
  64. // Delphi 6
  65. {$IFDEF VER140}
  66.   {$UNDEF DELPHI_VERSION_UNKNOW}
  67.   {$DEFINE DELPHI5_UP}
  68.   {$DEFINE DELPHI6_UP}
  69. {$ENDIF}
  70.  
  71. // Delphi 7
  72. {$IFDEF VER150}
  73.   {$UNDEF DELPHI_VERSION_UNKNOW}
  74.   {$DEFINE DELPHI5_UP}
  75.   {$DEFINE DELPHI6_UP}
  76.   {$DEFINE DELPHI7_UP}
  77. {$ENDIF}
  78.  
  79. // Delphi 8
  80. {$IFDEF VER160}
  81.   {$UNDEF DELPHI_VERSION_UNKNOW}
  82.   {$DEFINE DELPHI5_UP}
  83.   {$DEFINE DELPHI6_UP}
  84.   {$DEFINE DELPHI7_UP}
  85.   {$DEFINE DELPHI8_UP}
  86. {$ENDIF}
  87.  
  88. // Delphi 2005
  89. {$IFDEF VER170}
  90.   {$UNDEF DELPHI_VERSION_UNKNOW}
  91.   {$DEFINE DELPHI5_UP}
  92.   {$DEFINE DELPHI6_UP}
  93.   {$DEFINE DELPHI7_UP}
  94.   {$DEFINE DELPHI8_UP}
  95.   {$DEFINE DELPHI9_UP}
  96. {$ENDIF}
  97.  
  98. {$IFDEF VER180}
  99.   {$UNDEF DELPHI_VERSION_UNKNOW}
  100.   // Delphi 2007
  101.   {$IFDEF VER185}
  102.     {$DEFINE DELPHI5_UP}
  103.     {$DEFINE DELPHI6_UP}
  104.     {$DEFINE DELPHI7_UP}
  105.     {$DEFINE DELPHI8_UP}
  106.     {$DEFINE DELPHI9_UP}
  107.     {$DEFINE DELPHI10_UP}
  108.     {$DEFINE DELPHI11_UP}
  109.   // Delphi 2006
  110.   {$ELSE}
  111.     {$DEFINE DELPHI5_UP}
  112.     {$DEFINE DELPHI6_UP}
  113.     {$DEFINE DELPHI7_UP}
  114.     {$DEFINE DELPHI8_UP}
  115.     {$DEFINE DELPHI9_UP}
  116.     {$DEFINE DELPHI10_UP}
  117.   {$ENDIF}
  118. {$ENDIF}
  119.  
  120. // Delphi 2009
  121. {$IFDEF VER200}
  122.   {$UNDEF DELPHI_VERSION_UNKNOW}
  123.   {$DEFINE DELPHI5_UP}
  124.   {$DEFINE DELPHI6_UP}
  125.   {$DEFINE DELPHI7_UP}
  126.   {$DEFINE DELPHI8_UP}
  127.   {$DEFINE DELPHI9_UP}
  128.   {$DEFINE DELPHI10_UP}
  129.   {$DEFINE DELPHI11_UP}
  130.   {$DEFINE DELPHI12_UP}
  131. {$ENDIF}
  132.  
  133. //Delphi 2010
  134. {$IFDEF VER210}
  135.   {$UNDEF DELPHI_VERSION_UNKNOW}
  136.   {$DEFINE DELPHI5_UP}
  137.   {$DEFINE DELPHI6_UP}
  138.   {$DEFINE DELPHI7_UP}
  139.   {$DEFINE DELPHI8_UP}
  140.   {$DEFINE DELPHI9_UP}
  141.   {$DEFINE DELPHI10_UP}
  142.   {$DEFINE DELPHI11_UP}
  143.   {$DEFINE DELPHI12_UP}
  144.   {$DEFINE DELPHI14_UP}
  145. {$ENDIF}
  146.  
  147. // Delphi XE
  148. {$IFDEF VER220}
  149.   {$UNDEF DELPHI_VERSION_UNKNOW}
  150.   {$DEFINE DELPHI5_UP}
  151.   {$DEFINE DELPHI6_UP}
  152.   {$DEFINE DELPHI7_UP}
  153.   {$DEFINE DELPHI8_UP}
  154.   {$DEFINE DELPHI9_UP}
  155.   {$DEFINE DELPHI10_UP}
  156.   {$DEFINE DELPHI11_UP}
  157.   {$DEFINE DELPHI12_UP}
  158.   {$DEFINE DELPHI14_UP}
  159.   {$DEFINE DELPHI15_UP}
  160. {$ENDIF}
  161.  
  162. // Delphi XE2  (First FireMonkey and 64bit compiler)
  163. {$IFDEF VER230}
  164.   {$UNDEF DELPHI_VERSION_UNKNOW}
  165.   {$DEFINE DELPHI5_UP}
  166.   {$DEFINE DELPHI6_UP}
  167.   {$DEFINE DELPHI7_UP}
  168.   {$DEFINE DELPHI8_UP}
  169.   {$DEFINE DELPHI9_UP}
  170.   {$DEFINE DELPHI10_UP}
  171.   {$DEFINE DELPHI11_UP}
  172.   {$DEFINE DELPHI12_UP}
  173.   {$DEFINE DELPHI14_UP}
  174.   {$DEFINE DELPHI15_UP}
  175.   {$DEFINE DELPHI16_UP}
  176. {$ENDIF}
  177.  
  178. // Delphi XE3
  179. {$IFDEF VER240}
  180.   {$UNDEF DELPHI_VERSION_UNKNOW}
  181.   {$DEFINE DELPHI5_UP}
  182.   {$DEFINE DELPHI6_UP}
  183.   {$DEFINE DELPHI7_UP}
  184.   {$DEFINE DELPHI8_UP}
  185.   {$DEFINE DELPHI9_UP}
  186.   {$DEFINE DELPHI10_UP}
  187.   {$DEFINE DELPHI11_UP}
  188.   {$DEFINE DELPHI12_UP}
  189.   {$DEFINE DELPHI14_UP}
  190.   {$DEFINE DELPHI15_UP}
  191.   {$DEFINE DELPHI16_UP}
  192.   {$DEFINE DELPHI17_UP}
  193. {$ENDIF}
  194.  
  195. // Delphi XE4
  196. {$IFDEF VER250}
  197.   {$UNDEF DELPHI_VERSION_UNKNOW}
  198.   {$DEFINE DELPHI5_UP}
  199.   {$DEFINE DELPHI6_UP}
  200.   {$DEFINE DELPHI7_UP}
  201.   {$DEFINE DELPHI8_UP}
  202.   {$DEFINE DELPHI9_UP}
  203.   {$DEFINE DELPHI10_UP}
  204.   {$DEFINE DELPHI11_UP}
  205.   {$DEFINE DELPHI12_UP}
  206.   {$DEFINE DELPHI14_UP}
  207.   {$DEFINE DELPHI15_UP}
  208.   {$DEFINE DELPHI16_UP}
  209.   {$DEFINE DELPHI17_UP}
  210.   {$DEFINE DELPHI18_UP}
  211. {$ENDIF}
  212.  
  213. // Delphi XE5
  214. {$IFDEF VER260}
  215.   {$UNDEF DELPHI_VERSION_UNKNOW}
  216.   {$DEFINE DELPHI5_UP}
  217.   {$DEFINE DELPHI6_UP}
  218.   {$DEFINE DELPHI7_UP}
  219.   {$DEFINE DELPHI8_UP}
  220.   {$DEFINE DELPHI9_UP}
  221.   {$DEFINE DELPHI10_UP}
  222.   {$DEFINE DELPHI11_UP}
  223.   {$DEFINE DELPHI12_UP}
  224.   {$DEFINE DELPHI14_UP}
  225.   {$DEFINE DELPHI15_UP}
  226.   {$DEFINE DELPHI16_UP}
  227.   {$DEFINE DELPHI17_UP}
  228.   {$DEFINE DELPHI18_UP}
  229.   {$DEFINE DELPHI19_UP}
  230. {$ENDIF}
  231.  
  232. // Delphi XE6
  233. {$IFDEF VER270}
  234.   {$UNDEF DELPHI_VERSION_UNKNOW}
  235.   {$DEFINE DELPHI5_UP}
  236.   {$DEFINE DELPHI6_UP}
  237.   {$DEFINE DELPHI7_UP}
  238.   {$DEFINE DELPHI8_UP}
  239.   {$DEFINE DELPHI9_UP}
  240.   {$DEFINE DELPHI10_UP}
  241.   {$DEFINE DELPHI11_UP}
  242.   {$DEFINE DELPHI12_UP}
  243.   {$DEFINE DELPHI14_UP}
  244.   {$DEFINE DELPHI15_UP}
  245.   {$DEFINE DELPHI16_UP}
  246.   {$DEFINE DELPHI17_UP}
  247.   {$DEFINE DELPHI18_UP}
  248.   {$DEFINE DELPHI19_UP}
  249.   {$DEFINE DELPHI20_UP}
  250. {$ENDIF}
  251.  
  252. // Delphi XE7
  253. {$IFDEF VER280}
  254.   {$UNDEF DELPHI_VERSION_UNKNOW}
  255.   {$DEFINE DELPHI5_UP}
  256.   {$DEFINE DELPHI6_UP}
  257.   {$DEFINE DELPHI7_UP}
  258.   {$DEFINE DELPHI8_UP}
  259.   {$DEFINE DELPHI9_UP}
  260.   {$DEFINE DELPHI10_UP}
  261.   {$DEFINE DELPHI11_UP}
  262.   {$DEFINE DELPHI12_UP}
  263.   {$DEFINE DELPHI14_UP}
  264.   {$DEFINE DELPHI15_UP}
  265.   {$DEFINE DELPHI16_UP}
  266.   {$DEFINE DELPHI17_UP}
  267.   {$DEFINE DELPHI18_UP}
  268.   {$DEFINE DELPHI19_UP}
  269.   {$DEFINE DELPHI20_UP}
  270.   {$DEFINE DELPHI21_UP}
  271. {$ENDIF}
  272.  
  273. // Delphi XE8
  274. {$IFDEF VER290}
  275.   {$UNDEF DELPHI_VERSION_UNKNOW}
  276.   {$DEFINE DELPHI5_UP}
  277.   {$DEFINE DELPHI6_UP}
  278.   {$DEFINE DELPHI7_UP}
  279.   {$DEFINE DELPHI8_UP}
  280.   {$DEFINE DELPHI9_UP}
  281.   {$DEFINE DELPHI10_UP}
  282.   {$DEFINE DELPHI11_UP}
  283.   {$DEFINE DELPHI12_UP}
  284.   {$DEFINE DELPHI14_UP}
  285.   {$DEFINE DELPHI15_UP}
  286.   {$DEFINE DELPHI16_UP}
  287.   {$DEFINE DELPHI17_UP}
  288.   {$DEFINE DELPHI18_UP}
  289.   {$DEFINE DELPHI19_UP}
  290.   {$DEFINE DELPHI20_UP}
  291.   {$DEFINE DELPHI21_UP}
  292.   {$DEFINE DELPHI22_UP}
  293. {$ENDIF VER290}
  294.  
  295. // Rad Studio 10 - Delphi Seattle
  296. {$IFDEF VER300}
  297.   {$UNDEF DELPHI_VERSION_UNKNOW}
  298.   {$DEFINE DELPHI5_UP}
  299.   {$DEFINE DELPHI6_UP}
  300.   {$DEFINE DELPHI7_UP}
  301.   {$DEFINE DELPHI8_UP}
  302.   {$DEFINE DELPHI9_UP}
  303.   {$DEFINE DELPHI10_UP}
  304.   {$DEFINE DELPHI11_UP}
  305.   {$DEFINE DELPHI12_UP}
  306.   {$DEFINE DELPHI14_UP}
  307.   {$DEFINE DELPHI15_UP}
  308.   {$DEFINE DELPHI16_UP}
  309.   {$DEFINE DELPHI17_UP}
  310.   {$DEFINE DELPHI18_UP}
  311.   {$DEFINE DELPHI19_UP}
  312.   {$DEFINE DELPHI20_UP}
  313.   {$DEFINE DELPHI21_UP}
  314.   {$DEFINE DELPHI22_UP}
  315.   {$DEFINE DELPHI23_UP}
  316. {$ENDIF}
  317.  
  318. // Rad Studio 10.1 - Delphi Berlin
  319. {$IFDEF VER310}
  320.   {$UNDEF DELPHI_VERSION_UNKNOW}
  321.   {$DEFINE DELPHI5_UP}
  322.   {$DEFINE DELPHI6_UP}
  323.   {$DEFINE DELPHI7_UP}
  324.   {$DEFINE DELPHI8_UP}
  325.   {$DEFINE DELPHI9_UP}
  326.   {$DEFINE DELPHI10_UP}
  327.   {$DEFINE DELPHI11_UP}
  328.   {$DEFINE DELPHI12_UP}
  329.   {$DEFINE DELPHI14_UP}
  330.   {$DEFINE DELPHI15_UP}
  331.   {$DEFINE DELPHI16_UP}
  332.   {$DEFINE DELPHI17_UP}
  333.   {$DEFINE DELPHI18_UP}
  334.   {$DEFINE DELPHI19_UP}
  335.   {$DEFINE DELPHI20_UP}
  336.   {$DEFINE DELPHI21_UP}
  337.   {$DEFINE DELPHI22_UP}
  338.   {$DEFINE DELPHI23_UP}
  339.   {$DEFINE DELPHI24_UP}
  340. {$ENDIF}
  341.  
  342. // Rad Studio 10.2 - Delphi Tokyo
  343. {$IFDEF VER320}
  344.   {$UNDEF DELPHI_VERSION_UNKNOW}
  345.   {$DEFINE DELPHI5_UP}
  346.   {$DEFINE DELPHI6_UP}
  347.   {$DEFINE DELPHI7_UP}
  348.   {$DEFINE DELPHI8_UP}
  349.   {$DEFINE DELPHI9_UP}
  350.   {$DEFINE DELPHI10_UP}
  351.   {$DEFINE DELPHI11_UP}
  352.   {$DEFINE DELPHI12_UP}
  353.   {$DEFINE DELPHI14_UP}
  354.   {$DEFINE DELPHI15_UP}
  355.   {$DEFINE DELPHI16_UP}
  356.   {$DEFINE DELPHI17_UP}
  357.   {$DEFINE DELPHI18_UP}
  358.   {$DEFINE DELPHI19_UP}
  359.   {$DEFINE DELPHI20_UP}
  360.   {$DEFINE DELPHI21_UP}
  361.   {$DEFINE DELPHI22_UP}
  362.   {$DEFINE DELPHI23_UP}
  363.   {$DEFINE DELPHI24_UP}
  364.   {$DEFINE DELPHI25_UP}
  365. {$ENDIF}
  366.  
  367. // Rad Studio 10.3 - Delphi Rio
  368. {$IFDEF VER330}
  369.   {$UNDEF DELPHI_VERSION_UNKNOW}
  370.   {$DEFINE DELPHI5_UP}
  371.   {$DEFINE DELPHI6_UP}
  372.   {$DEFINE DELPHI7_UP}
  373.   {$DEFINE DELPHI8_UP}
  374.   {$DEFINE DELPHI9_UP}
  375.   {$DEFINE DELPHI10_UP}
  376.   {$DEFINE DELPHI11_UP}
  377.   {$DEFINE DELPHI12_UP}
  378.   {$DEFINE DELPHI14_UP}
  379.   {$DEFINE DELPHI15_UP}
  380.   {$DEFINE DELPHI16_UP}
  381.   {$DEFINE DELPHI17_UP}
  382.   {$DEFINE DELPHI18_UP}
  383.   {$DEFINE DELPHI19_UP}
  384.   {$DEFINE DELPHI20_UP}
  385.   {$DEFINE DELPHI21_UP}
  386.   {$DEFINE DELPHI22_UP}
  387.   {$DEFINE DELPHI23_UP}
  388.   {$DEFINE DELPHI24_UP}
  389.   {$DEFINE DELPHI25_UP}
  390.   {$DEFINE DELPHI26_UP}
  391. {$ENDIF}
  392.  
  393. // Rad Studio 10.4 - Delphi Sydney
  394. {$IFDEF VER340}
  395.   {$UNDEF DELPHI_VERSION_UNKNOW}
  396.   {$DEFINE DELPHI5_UP}
  397.   {$DEFINE DELPHI6_UP}
  398.   {$DEFINE DELPHI7_UP}
  399.   {$DEFINE DELPHI8_UP}
  400.   {$DEFINE DELPHI9_UP}
  401.   {$DEFINE DELPHI10_UP}
  402.   {$DEFINE DELPHI11_UP}
  403.   {$DEFINE DELPHI12_UP}
  404.   {$DEFINE DELPHI14_UP}
  405.   {$DEFINE DELPHI15_UP}
  406.   {$DEFINE DELPHI16_UP}
  407.   {$DEFINE DELPHI17_UP}
  408.   {$DEFINE DELPHI18_UP}
  409.   {$DEFINE DELPHI19_UP}
  410.   {$DEFINE DELPHI20_UP}
  411.   {$DEFINE DELPHI21_UP}
  412.   {$DEFINE DELPHI22_UP}
  413.   {$DEFINE DELPHI23_UP}
  414.   {$DEFINE DELPHI24_UP}
  415.   {$DEFINE DELPHI25_UP}
  416.   {$DEFINE DELPHI26_UP}
  417.   {$DEFINE DELPHI27_UP}
  418. {$ENDIF}
  419.  
  420. // Rad Studio 11.0 - Delphi Alexandria
  421. {$IFDEF VER350}
  422.   {$UNDEF DELPHI_VERSION_UNKNOW}
  423.   {$DEFINE DELPHI5_UP}
  424.   {$DEFINE DELPHI6_UP}
  425.   {$DEFINE DELPHI7_UP}
  426.   {$DEFINE DELPHI8_UP}
  427.   {$DEFINE DELPHI9_UP}
  428.   {$DEFINE DELPHI10_UP}
  429.   {$DEFINE DELPHI11_UP}
  430.   {$DEFINE DELPHI12_UP}
  431.   {$DEFINE DELPHI14_UP}
  432.   {$DEFINE DELPHI15_UP}
  433.   {$DEFINE DELPHI16_UP}
  434.   {$DEFINE DELPHI17_UP}
  435.   {$DEFINE DELPHI18_UP}
  436.   {$DEFINE DELPHI19_UP}
  437.   {$DEFINE DELPHI20_UP}
  438.   {$DEFINE DELPHI21_UP}
  439.   {$DEFINE DELPHI22_UP}
  440.   {$DEFINE DELPHI23_UP}
  441.   {$DEFINE DELPHI24_UP}
  442.   {$DEFINE DELPHI25_UP}
  443.   {$DEFINE DELPHI26_UP}
  444.   {$DEFINE DELPHI27_UP}
  445.   {$DEFINE DELPHI28_UP}
  446. {$ENDIF}
  447.  
  448. {$IFDEF FPC}
  449.   {$DEFINE SUPPORTS_INLINE}
  450.   {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)}
  451.     {$DEFINE FPC_VER_320}
  452.   {$IFEND}
  453. {$ELSE}
  454.   {$IFDEF DELPHI_VERSION_UNKNOW}
  455.     {$DEFINE DELPHI5_UP}
  456.     {$DEFINE DELPHI6_UP}
  457.     {$DEFINE DELPHI7_UP}
  458.     {$DEFINE DELPHI8_UP}
  459.     {$DEFINE DELPHI9_UP}
  460.     {$DEFINE DELPHI10_UP}
  461.     {$DEFINE DELPHI11_UP}
  462.     {$DEFINE DELPHI12_UP}
  463.     {$DEFINE DELPHI14_UP}
  464.     {$DEFINE DELPHI15_UP}
  465.     {$DEFINE DELPHI16_UP}
  466.     {$DEFINE DELPHI17_UP}
  467.     {$DEFINE DELPHI18_UP}
  468.     {$DEFINE DELPHI19_UP}
  469.     {$DEFINE DELPHI20_UP}
  470.     {$DEFINE DELPHI21_UP}
  471.     {$DEFINE DELPHI22_UP}
  472.     {$DEFINE DELPHI23_UP}
  473.     {$DEFINE DELPHI24_UP}
  474.     {$DEFINE DELPHI25_UP}
  475.     {$DEFINE DELPHI26_UP}
  476.     {$DEFINE DELPHI27_UP}
  477.         {$DEFINE DELPHI28_UP}
  478.   {$ENDIF}
  479. {$ENDIF}
  480.  
  481. {$IFDEF DELPHI9_UP}
  482.   {$DEFINE SUPPORTS_INLINE}
  483. {$ENDIF}
  484.  
  485. {$IF DEFINED(CPUX32) OR
  486.      DEFINED(CPU32) OR
  487.      DEFINED(CPU32BITS) OR
  488.      DEFINED(CPUARM32) OR
  489.      DEFINED(WIN32) OR
  490.      DEFINED(IOS32) OR
  491.      DEFINED(MACOS32) OR
  492.      DEFINED(LINUX32) OR
  493.      DEFINED(POSIX32) OR
  494.      DEFINED(ANDROID32)}
  495.   {$DEFINE TARGET_32BITS}
  496. {$ELSE}
  497.   {$IF DEFINED(CPUX64) OR
  498.        DEFINED(CPU64) OR
  499.        DEFINED(CPU64BITS) OR
  500.        DEFINED(CPUARM64) OR
  501.        DEFINED(WIN64) OR
  502.        DEFINED(IOS64) OR
  503.        DEFINED(MACOS64) OR
  504.        DEFINED(LINUX64) OR
  505.        DEFINED(POSIX64) OR
  506.        DEFINED(ANDROID64)}
  507.     {$DEFINE TARGET_64BITS}
  508.   {$IFEND}
  509. {$IFEND}
The ratio is that compatibility between the compilers in mode delphi is such that you can better spoof a Delphi version number, provided that you keep in mind that everything needs to be -Mdelphi or -Mdelphiunicode.
The latter is not tested by me.
Many include files suffer the same issue with disastrously confusing results.
Also note that the mode is only needed for the CEF units. For your Lazarus application units it is completely transparent.
If there is still an issue, plz report.
In this case the code is spoofed to Delphi 2007, but you can spoof much higher versions if the code is UTF16 ready.
« Last Edit: October 03, 2025, 08:00:15 pm by Thaddy »
Due to censorship, I changed this to "Nelly the Elephant". Keeps the message clear.

loaded

  • Hero Member
  • *****
  • Posts: 876
Re: CEF for dummies - where to name the path?
« Reply #8 on: October 05, 2025, 10:14:54 am »
I create all my CEF projects using the following logic, so my multiple projects run smoothly:

-The compiled executable will be created outside the source code folder.
-The compiled executable will retrieve the library files from a specific folder.

Code: Pascal  [Select][+][-]
  1. procedure CreateGlobalCEFApp;
  2. begin
  3.   GlobalCEFApp                     := TCefApplication.Create;
  4.   GlobalCEFApp.cache               := 'cache';
  5.   GlobalCEFApp.LogFile             := 'cache\debug.log';
  6.   GlobalCEFApp.LogSeverity         := LOGSEVERITY_INFO;
  7.   GlobalCEFApp.EnablePrintPreview  := True;
  8.   GlobalCEFApp.OnWebKitInitialized := @GlobalCEFApp_OnWebKitInitialized;
  9.  
  10.   GlobalCEFApp.FrameworkDirPath := UTF8ToCP1254(ExtractFilePath(ParamStr(0))) + 'Libraries\';
  11.   GlobalCEFApp.ResourcesDirPath := UTF8ToCP1254(ExtractFilePath(ParamStr(0))) + 'Libraries\';
  12.   GlobalCEFApp.LocalesDirPath := UTF8ToCP1254(ExtractFilePath(ParamStr(0)))   + 'Libraries\locales';
  13. end;
The more memory computers have, the less memory people seem to use. 😅

 

TinyPortal © 2005-2018