Chromium Embedded Framework (CEF) Standard Binary Distribution for Windows
-------------------------------------------------------------------------------
Date: May 07, 2024
CEF Version: 124.3.5+gff7dcd8+chromium-124.0.6367.119
CEF URL: https://bitbucket.org/chromiumembedded/cef.git
@ff7dcd851eab996935594cd9986256de2ca74c1e
Chromium Version: 124.0.6367.119
Chromium URL: https://chromium.googlesource.com/chromium/src.git
@815c2f826541d726696cd5a89d01a945cb3aed1c
This distribution contains all components necessary to build and distribute an
application using CEF on the Windows platform. Please see the LICENSING
section of this document for licensing terms and conditions.
CONTENTS
--------
cmake Contains CMake configuration files shared by all targets.
Debug Contains libcef.dll, libcef.lib and other components required to
build and run the debug version of CEF-based applications. By
default these files should be placed in the same directory as the
executable and will be copied there as part of the build process.
include Contains all required CEF header files.
libcef_dll Contains the source code for the libcef_dll_wrapper static library
that all applications using the CEF C++ API must link against.
Release Contains libcef.dll, libcef.lib and other components required to
build and run the release version of CEF-based applications. By
default these files should be placed in the same directory as the
executable and will be copied there as part of the build process.
Resources Contains resources required by libcef.dll. By default these files
should be placed in the same directory as libcef.dll and will be
copied there as part of the build process.
tests/ Directory of tests that demonstrate CEF usage.
cefclient Contains the cefclient sample application configured to build
using the files in this distribution. This application demonstrates
a wide range of CEF functionalities.
cefsimple Contains the cefsimple sample application configured to build
using the files in this distribution. This application demonstrates
the minimal functionality required to create a browser window.
ceftests Contains unit tests that exercise the CEF APIs.
gtest Contains the Google C++ Testing Framework used by the ceftests
target.
shared Contains source code shared by the cefclient and ceftests targets.
USAGE
-----
Building using CMake:
CMake can be used to generate project files in many different formats. See
usage instructions at the top of the CMakeLists.txt file.
Please visit the CEF Website for additional usage information.
https://bitbucket.org/chromiumembedded/cef/
REDISTRIBUTION
--------------
This binary distribution contains the below components.
Required components:
The following components are required. CEF will not function without them.
* CEF core library.
* libcef.dll
* Crash reporting library.
* chrome_elf.dll
* Unicode support data.
* icudtl.dat
* V8 snapshot data.
* snapshot_blob.bin
* v8_context_snapshot.bin
Optional components:
The following components are optional. If they are missing CEF will continue to
run but any related functionality may become broken or disabled.
* Localized resources.
Locale file loading can be disabled completely using
CefSettings.pack_loading_disabled. The locales directory path can be
customized using CefSettings.locales_dir_path.
* locales/
Directory containing localized resources used by CEF, Chromium and Blink. A
.pak file is loaded from this directory based on the CefSettings.locale
value. Only configured locales need to be distributed. If no locale is
configured the default locale of "en-US" will be used. Without these files
arbitrary Web components may display incorrectly.
* Other resources.
Pack file loading can be disabled completely using
CefSettings.pack_loading_disabled. The resources directory path can be
customized using CefSettings.resources_dir_path.
* chrome_100_percent.pak
* chrome_200_percent.pak
* resources.pak
These files contain non-localized resources used by CEF, Chromium and Blink.
Without these files arbitrary Web components may display incorrectly.
* Direct3D support.
* d3dcompiler_47.dll
Support for GPU accelerated rendering of HTML5 content like 2D canvas, 3D CSS
and WebGL. Without this file the aforementioned capabilities may fail when GPU
acceleration is enabled (default in most cases). Use of this bundled version
is recommended instead of relying on the possibly old and untested system
installed version.
* DirectX compiler support (x64 only).
* dxil.dll
* dxcompiler.dll
Support for DirectX rendering of WebGPU. Without these files the
aforementioned capabilities may fail.
* ANGLE support.
* libEGL.dll
* libGLESv2.dll
Support for rendering of HTML5 content like 2D canvas, 3D CSS and WebGL.
Without these files the aforementioned capabilities may fail.
* SwANGLE support.
* vk_swiftshader.dll
* vk_swiftshader_icd.json
* vulkan-1.dll
Support for software rendering of HTML5 content like 2D canvas, 3D CSS and
WebGL using SwiftShader's Vulkan library as ANGLE's Vulkan backend. Without
these files the aforementioned capabilities may fail when GPU acceleration is
disabled or unavailable.
LICENSING
---------
The CEF project is BSD licensed. Please read the LICENSE.txt file included with
this binary distribution for licensing terms and conditions. Other software
included in this distribution is provided under other licenses. Please visit
"about:credits" in a CEF-based application for complete Chromium and third-party
licensing information.
C#学习笔记12:Winform网页操作-CefSharp内嵌浏览器

在C#编程中,开发Windows桌面应用程序时,有时我们需要在应用程序内部嵌入一个浏览器控件,以便用户可以在不离开应用的情况下浏览网页。本篇学习笔记将聚焦于如何使用CefSharp库在Winform应用程序中实现这一功能。CefSharp是一个.NET封装的Chromium Embedded Framework(CEF),它允许开发者在他们的应用中嵌入一个功能完备的浏览器引擎。
我们需要安装CefSharp库。在Visual Studio中,可以通过NuGet包管理器来添加`CefSharp.WinForms`包。这将为我们的项目引入所需的CefSharp组件。
接下来,我们创建一个新的Winform窗体,并在窗体上添加一个名为` ChromiumWebBrowser `的控件。这个控件是CefSharp提供的,它实际上就是一个内置的浏览器。在设计视图中,可以通过拖放或在代码中手动创建:
```csharp
var browser = new ChromiumWebBrowser("http://www.example.com");
this.Controls.Add(browser);
```
这里的`http://www.example.com`是加载的初始网址。你可以根据需要替换为你想要加载的任何网页。
为了在运行时初始化CefSharp,需要在`Program.cs`的`Main`方法中添加以下代码:
```csharp
CefSharpSettings.LegacyJavascriptBindingEnabled = true;
Cef.Initialize(new CefSettings());
```
这会启动CEF框架并启用JavaScript的绑定,使我们能够与网页中的JavaScript进行交互。
然后,在窗体的加载事件中,我们可以确保浏览器在窗体显示时已经准备就绪:
```csharp
private void Form1_Load(object sender, EventArgs e)
{
if (!Cef.IsInitialized)
{
Cef.Initialize(new CefSettings());
}
// 设置浏览器窗口大小
browser.Dock = DockStyle.Fill;
}
```
在使用CefSharp时,我们还可以利用其丰富的API执行各种操作,如加载URL、执行JavaScript代码、处理导航事件等。例如,可以监听浏览器的加载完成事件:
```csharp
browser.LoadingStateChanged += (sender, args) =>
{
if (!args.IsLoading)
{
MessageBox.Show("页面已加载完毕");
}
};
```
此外,CefSharp还支持注入自定义的JavaScript对象到网页上下文中,这样可以从C#代码中调用JavaScript函数:
```csharp
public class MyBinder : IRenderProcessMessageHandler
{
public void OnBeforeBrowse(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, bool isRedirect, string url, RequestCallback callback)
{
}
public void OnContextCreated(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame)
{
frame.RegisterJsObject("myBinder", this);
}
// 在这里定义要暴露给JavaScript的C#方法
public void CallFromJavaScript(string message)
{
MessageBox.Show($"从JavaScript收到消息:{message}");
}
}
// 在窗体构造函数中设置
browser.RegisterAsyncJsObject("myBinder", new MyBinder());
```
以上代码展示了如何创建一个JavaScript对象`myBinder`,并在网页中调用它的`CallFromJavaScript`方法。这为C#和JavaScript之间提供了双向通信的桥梁。
通过以上步骤,你已经成功地在Winform应用程序中集成了CefSharp内嵌浏览器。这个功能强大的控件不仅能够展示网页,还能实现更多高级功能,如页面交互、数据通信等。对于需要在桌面应用中嵌入网页功能的开发者来说,CefSharp是一个非常实用的工具。
为了更好地理解和实践,你可以下载提供的`WpfWithCefSharpDemo`工程,其中包含了完整的示例代码和运行环境,便于你进行测试和学习。通过实际操作,相信你会对CefSharp有更深入的理解。

NULL指向我
- 粉丝: 2978
最新资源
- (源码)基于Python语言的forestpy项目.zip
- 计算机系统结构课程中模拟Tomasulo算法动态调度机制的实验项目-动态指令调度-寄存器重命名-保留站-公共数据总线-乱序执行-分支预测-流水线冲突解决-性能优化分析用于深入理解-.ZIP
- (源码)基于GNU make的C语言编程学习教程.zip
- (源码)基于Node.js的B站动态抽奖自动化脚本.zip
- 从零开始实现视觉SLAM与机器人算法的Python实践教程-包含ORB特征点提取对极几何视觉里程计后端优化三维重建Otsu二值化贝叶斯滤波连通域标记目标跟踪等完整S.zip
- (源码)基于React框架的通用前端模板工程.zip
- Java+MySQL+vuejs健身房管理系统、健身房会员管理系统
- gqy20-SLAIS-62936-1753627358636.zip
- 基于物联网与人工智能技术的智慧办公室综合管理系统-集成环境监测-智能门禁-自动化考勤-会议预约-能耗管理-设备远程控制-数据分析可视化-移动办公应用-多终端协同-云端数据同步-智能.zip
- jdh-algo-JoyDataForge-5912-1753356682062.zip
- java毕业设计,广告管理系统
- 基于DeepSeek-API的AI专业术语智能翻译服务系统-人工智能-机器学习-深度学习-自然语言处理-专业术语库-英汉互译-论文翻译-文档翻译-技术文档-学术研究-科研辅助-精准.zip
- forthespada-Awsome-Courses-19764-1752995359733.zip
- Java图书馆座位管理系统
- 基于SpringSpringMVCMyBatis框架开发的高校学生宿舍综合管理系统-包含宿舍分配-水电费管理-访客登记-报修处理-卫生检查等功能模块-用于高校后勤部门对学生宿舍.zip
- HNU2024春季计算机系统课程配套代码仓库-包含CSAPP教材配套实验代码和课堂实例-用于计算机系统原理教学和实验-汇编语言-C语言-计算机组成原理-操作系统基础-处理器架构-内.zip