首页 > 代码库 > C# : CEF操作
C# : CEF操作
代码挺差的,仅供学习、参考
class CEFGlueLoader { class CefAppImpl : CefApp { protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine) { commandLine.AppendArgument("enable-npapi"); commandLine.AppendSwitch("enable-media-stream", "enable-media-stream"); commandLine.AppendSwitch("process-per-site"); commandLine.AppendSwitch("ppapi-flash-version", "23.0.0.185");//PepperFlash\manifest.json中的version commandLine.AppendSwitch("ppapi-flash-path", "PepperFlash\\pepflashplayer.dll"); } } public static void InitCEF() {#if !_ORG_MANAGER && !_MBMAKER CefRuntime.Load(); string[] args = new string[0]; var mainArgs = new CefMainArgs(args); var app = new CefAppImpl(); var exitCode = CefRuntime.ExecuteProcess(mainArgs, app); System.Diagnostics.Trace.WriteLine("CefRuntime.ExecuteProcess return: " + exitCode); if (exitCode != -1) { return; } var settings = new CefSettings { BrowserSubprocessPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\Cef3Process.exe"), SingleProcess = false, MultiThreadedMessageLoop = true, LogSeverity = CefLogSeverity.Default, LogFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"log\CefGlue.log"), CachePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"cache"), CommandLineArgsDisabled = true, Locale = "zh_CN", LocalesDirPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"bin\locales"), RemoteDebuggingPort = 7789, }; CefRuntime.Initialize(mainArgs, settings, app); if (!settings.MultiThreadedMessageLoop) { System.Windows.Forms.Application.Idle += (sender, e) => { CefRuntime.DoMessageLoopWork(); }; }#endif } private static string GetPath(string v) { return Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, v)); } public static void ShutDownCEF() {#if !_ORG_MANAGER && !_MBMAKER try { CefRuntime.Shutdown(); } catch (Exception) { }#endif } }
C# : CEF操作
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。