This project is not currently maintained, but if you're interested get in touch
The Chrome Embedded Framework Toolkit for LabVIEW (LVCef) utilizes the Xilium.CefGlue .NET interface for Chrome Embedded Framework 3.X and provides a Windows Form control + LabVIEW library with the following properties:
- LVCef does not require the creation of .NET classes to override callbacks. Instead, functionality is implemented through .NET delegates wherever possible
- The class structure stays very close to the Xilium.CefGlue structure to make referencing the original CEF documentation straightforward
- The .NET control does very little automatic initialization giving the implementer as much flexibility as possible
- A separate dedicated render process is used instead of running multiple instances of the browser process
- Extensive debugging statements are included to enable monitoring of the life cycle of the control, see Debugging LVCef .NET Assemblies
While the goal of the project is high interoperability with the LabVIEW Development Environment, the LVCef client implementation is generic enough to be utilized in other .NET applications. Some use cases would be in plug-in like environments (where dedicated render processes are required, etc.) or for trying to get a clearer grasp of using the CEF API.
- CEF 3.2171.1949 Windows 32-bit
- Xilium.CefGlue Commit 335450e
Instructions for starting up and running examples:
-
Download a copy of the LVCef source repository. For a description of the different components of the project see Source Project Layout
-
Open the /dotnet/lvcef.sln project in Visual Studio 2012. The source has been tested to run in Visual Studio 2012 Express on Windows 7. It may be possible to use other versions of Visual Studio as well.
While LVCef currently uses .NET 3.5 it is not strictly necessary and it may be possible to use newer versions of .NET, etc.
-
Follow the instructions in Important Build Notes to correctly configure the projects
-
Build all of the projects in the /dotnet/lvcef.sln. To build a project right click on the name of the project in the Solution Explorer and select Build. Repeat the process for each project in the Solution Explorer.
-
Before executing the LVCef.TestControlAppSimple demo start a local http server to locally host the files in the /html directory.
A simple webserver written in LabVIEW has been provided as an option. Run the /lv/runwithpaths.bat file to start LabVIEW with the correctly configured paths. The script may need to be tweaked for different versions of LabVIEW, see Source Project Layout and the /lv section for more information.
In the lvcef project window open and run tools/SimpleHTTPServer.vi with the default control values. You can test that the web server is running by visiting localhost:8000 or pressing the Open Browser button on the front panel of the SimpleHTTPServer VI.
-
With the web server running, build and execute the TestControlAppSimple demo to see a Windows Form Application run and utilize the LVCefControl to render a web application. To start TestControlAppSimple right click on the project in the project explorer and go to Debug > Start New Instance.
-
To execute the example in LabVIEW, make sure LabVIEW was started using the script at the /lv/runwithpaths.bat location so that the paths are properly configured. The script may need to be tweaked for different versions of LabVIEW, see Source Project Layout and the /lv section for more information.
-
LabVIEW will launch and open the lvcef.lvproj project. Before running any of the LVCef Example VIs perform a Mass compile of the project. see Important Build Notes
-
Inside the lvcef project, run the /lvcef/Init.vi once (it should only be run once while the LabVIEW.exe process is running).
Note: Only run Init VI again if LabVIEW is completely shutdown and restarted. Do not run Init VI between execution of different VIs if the LabVIEW.exe process stays running between VIs
-
Run the different Example VIs in the lvcef.proj in the /examples directory to have the LVCefControl render a web application on the LabVIEW front panel. To understand more about what is going on see the Required Reading section and the Source Project Layout section
CEF is a very large codebase with a diverse feature set that is easy to get lost in. The following documents are required reading to gain the background needed to modify and develop LVCef controls to use in your HTML5 powered applications:
Developers wishing to use LVCef in a project should refer to the Deployed Project Layout section. Developers wishing to inspect the source, modify, and build LVCev should continue in this section.
The projects use relative paths as much as possible to make building and testing code as easy as possible for LVCef developers. The following project structure does not reflect the layout of the deployed LVCef project on a users system (see Deployed Project Layout).
In addition, not all project configuration could be modified for relative paths and some manual configuration is required to successfully build and run LVCef. Please see Important Build Notes for more information.
The following top-level directories are used to organize the LVCef project:
The /cef directory contains a Release binary of the Chrome Embedded Framework for the CEF version specified in Current Library Versions. The Release binaries have been Included in the repository for simplicity as CEF is not made available in a package management system.
For debugging purposes, the release symbols, as well as the debug binary and debug symbols, can be found at the CEF Builds page. Take note of the Branch number as well as the Revision number when downloading binaries and symbol files.
This directory contains the commit revision specified in Current Library Versions for the Xilium.CefGlue project. The repository is included for simplicity as a different version control system is utilized than LVCef. To see the version of CEF that Xilium.CefGlue is targeting you can reference the following file:
/xilium.cefglue/CefGlue/Interop/version.g.cs
As of the commit listed in Current Library Versions there are no modifications to the Xilium.CefGlue source required by the LVCef project so a direct replacement with the repository revision is possible. If future modifications are required to Xilium.CefGlue to support LVCef they will be documented in this Readme.
The source files for the LVCef .NET code is located in /dotnet and is divided into the following projects:
-
CefGlue: A project reference added from the /xilium.cefglue directory
-
LVCef: The bulk of the implementation broken into the following major components:
- A Windows Form Control called LVCefControl for use in Windows Forms applications / LabVIEW Front Panels.
- Handlers (App and Client) used for implementing the vast majority of the different behaviors and functionality in the LVCef Control, i.e. JavaScript communication, Request Handling, URL Navigation
-
LVCef.RenderApp: A lightweight dedicated render process implementation meant to execute independently from the LabVIEW execution context. CEF will spin-up multiple instances of the Render process as needed. For more information see the Required Reading section above.
-
LVCef.TestControlAppSimple: A sample application written in C# that utilizes the LVCef control. When running the example from within Visual Studio make sure to follow the steps in the Important Build Notes section.
If running the sample outside of Visual Studio after it has been built a helper batch file is provided to configure the working directory and run the app:
/dotnet/LVCef.TestControlAppSimple/runwithpaths.bat
Modifications to the batch file may be required to support Release vs Debug configuration, etc.
A directory containing example HTML/CSS/JS applications for use with the LVCef.TestControlAppSimple as well as with the sample VIs in the /lv directory.
The logs directory is empty by default (containing just a place holder file) but the directory is required to be in available in order to have the different processes correctly log information during execution
The lv directory contains the project files and LabVIEW source code to wrap the LVCef .NET library and the LVCefControl component. The LabVIEW source is still very much a work in progress until the LVCef .NET API has stabilized.
This directory contains a batch file that will launch LabVIEW using the correct working directory so the libcef.dll will be properly identified:
/lv/runwithpaths.bat
Modifications to the batch file may be required to support different versions of LabVIEW, etc.
Projects that reference the lvcef.dll need to have the Working directory modified in order to have the lvcef.dll detectable on the path. The two projects that will need to be configured are the LVCef.RenderApp project and the TestControlAppSimple project. To configure the Working Directory right click on the project to be configured in the Solution Explorer and go to Properties. In the Properties window go to the Debug tab and in the Working Directory field specify the /cef/ directory.
This has to be performed manually as relative paths cannot be used in C# projects for specifying the Working Directory.
When the project is first synced the paths to the .NET assemblies referenced by the VIs will need to be updated. In the lvcef.lvproj project window right click on the project name and choose Mass Compile. If a VI is opened or run before the Mass Compile is performed you may need to manually update any opened VIs (i.e. reselect constructors for the constructor node, reselect invoke node functions, etc). This step will be mitigated by the process discussed in the Deployed Project Layout section for installed systems.
The LVCef .NET Assemblies have debugging logging added for most functions and delegates that are executed. A convenient way to see the logging statements is to use the Debug View tool from Microsoft SysInternals. The debug logging statements are only configured to be available when LVCef is built in the Debug configuration.
Developers wishing to inspect the source, modify, and build LVCev should refer to the Source Project Layout section. Developers wishing to use LVCef in a project should continue in this section.
The details for how LVCef will be installed in <LabVIEW>/vi.lib have yet to be determined.
-
How do I decrease the size of the libcef dll or remove unwanted features?
To remove unwanted features you have to create a custom build of CEF.