演示如何将 cef 文件放到一个单独的目录下面,以及让 cef 使用内置的 flash:
function CefLibPath: string; begin {$IFDEF CPUX64} Result := ‘CEF_3.3239.1709\Core64‘; {$ELSE} Result := ‘CEF_3.3239.1709\Core‘; {$ENDIF} end; function PpapiFlashFileName: string; begin {$IFDEF CPUX64} Result := CefLibPath + ‘\plugins\pepflashplayer64.dll‘ {$ELSE} Result := CefLibPath + ‘\plugins\pepflashplayer32.dll‘ {$ENDIF} end; begin GlobalCEFApp := TCefApplication.Create; // In case you want to use custom directories for the CEF3 binaries, cache, cookies and user data. // If you don‘t set a cache directory the browser will use in-memory cache. GlobalCEFApp.FrameworkDirPath := CefLibPath; GlobalCEFApp.ResourcesDirPath := CefLibPath; GlobalCEFApp.LocalesDirPath := CefLibPath + ‘\locales‘; GlobalCEFApp.Cache := CefLibPath + ‘\cache‘; GlobalCEFApp.Cookies := CefLibPath + ‘\cookies‘; GlobalCEFApp.UserDataPath := CefLibPath + ‘\User Data‘; // GlobalCEFApp.CustomFlashPath := CefLibPath + ‘\plugins‘; GlobalCEFApp.LocalesRequired := ‘zh-CN‘; GlobalCEFApp.FlashEnabled := False; GlobalCEFApp.EnableGPU := True; // Enable hardware acceleration GlobalCEFApp.DisableGPUCache := True; // Disable the creation of a ‘GPUCache‘ directory in the hard drive. GlobalCEFApp.AddCustomCommandLine(‘--ppapi-flash-path‘, PpapiFlashFileName); // You *MUST* call GlobalCEFApp.StartMainProcess in a if..then clause // with the Application initialization inside the begin..end. // Read this https://www.briskbard.com/index.php?lang=en&pageid=cef if GlobalCEFApp.StartMainProcess then begin Application.Initialize; {$IFDEF DELPHI11_UP} Application.MainFormOnTaskbar := True; {$ENDIF} Application.CreateForm(TForm1, Form1); Application.Run; end; GlobalCEFApp.Free; end.