运行cefsharp浏览器

编程入门 行业动态 更新时间:2024-10-11 09:19:29
本文介绍了运行cefsharp浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我对使用Windows窗体的CefSharp没有成功。该项目编制。但浏览器控件永远不会启动。该日志包括以下两条消息。 [1105 / 111450.741:ERROR:browser_gpu_channel_host_factory.cc(119)]无法启动GPU进程。 [1105 / 111450.835:错误:gpu_process_transport_factory.cc(1027)]丢失的UI共享上下文。 我找不到整个示例项目。我在哪里可以看到或帮助?我正在使用VS2017社区版。 我尝试过: 我试图使用较旧的GitHub版本但没有成功。和X86和X64的不同版本。他们都有同样的问题。

I have no success with the CefSharp with windows forms. The project compiles. But the browser control never launches. The log includes the following two messages. [1105/111450.741:ERROR:browser_gpu_channel_host_factory.cc(119)] Failed to launch GPU process. [1105/111450.835:ERROR:gpu_process_transport_factory.cc(1027)] Lost UI shared context. I can't find a sample project in its entirety. Where can I look or help? I'm using VS2017 community edition. What I have tried: I've tried to use older GitHub versions without success. And different builds for X86 and X64. They all have the same problem.

推荐答案

从我记得,这是几年前,我必须确保我的托管应用程序是x86。这是我的初始化序列: From what I recall, and this is from a few years back, I had to make sure my hosting app was x86. This was my initialization sequence: Cef.EnableHighDPISupport(); CefSettings settings = new CefSettings(); settings.CachePath = "[somePath]\cache"); settings.RemoteDebuggingPort = 8088; // If you want to enable remote debugging Cef.Initialize(settings); browser = new ChromiumWebBrowser("www.google");

并挂钩一些事件并注册.NET对象:

and hooking up some events and registering a .NET object:

browser.FrameLoadEnd += OnPageLoaded; browser.LoadError += OnLoadError; browser.ConsoleMessage += OnConsoleMessage; browser.RegisterJsObject("dotNet", scriptObject);

并且在退出前不要忘记:

and don't forget before you exit:

Cef.Shutdown();

希望有所帮助!

Hope that helps!

更多推荐

运行cefsharp浏览器

本文发布于:2023-11-28 18:33:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643499.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:浏览器   cefsharp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!