Skip to content

Cef Howtos

MIkE edited this page Jan 24, 2018 · 9 revisions


Features: Development Console, render browser output to texture
Example in aardvark-platform/template MediaUI.fs

Init at the start of your program:

Aardvark.UI.Chromium.init args


use ctrl = new Aardvark.UI.AardvarkCefBrowser()
ctrl.StartUrl <- ""
ctrl.Dock <- DockStyle.Fill

w/o Aardvark.Media

Example code see CefGlueDemo/DemoApp.cs at XiliumCefGlue
or Aardvark.Cef.WinForms/ChromiumStuff.fs from

NuGet Packages:

Init at the start of your program:

using Xilium.CefGlue;
class MyCeffApp : CefApp {}
var settings = new CefSettings();
settings.MultiThreadedMessageLoop = (CefRuntime.Platform == CefRuntimePlatform.Windows);
var mainArgs = new CefMainArgs(args);
var app = new MyCeffApp();

var code = CefRuntime.ExecuteProcess(new CefMainArgs(args), app, IntPtr.Zero);
if (code == -1)
    CefRuntime.Initialize(mainArgs, settings, app, IntPtr.Zero);

Setup Winform Control:

class MyCefBrowser : CefWebBrowser {}
var ctrl = new MyCefBrowser();
ctrl.Dock = DockStyle.Fill;
ctrl.StartUrl = "";

Separate Executable

By setting CefSettings.BrowserSubprocessPath to an executable with the required Cef code, this exec will be started instead of the main program.

class Program
    private class MyCeffApp : CefApp { }

    static int Main(string[] args)
        return CefRuntime.ExecuteProcess(
            new CefMainArgs(args),
            new MyCeffApp(),

Main program:

var settings = new CefSettings();
settings.MultiThreadedMessageLoop = (CefRuntime.Platform == CefRuntimePlatform.Windows);
settings.BrowserSubprocessPath = "Dibit-Cef.exe";

    new CefMainArgs(new string[0]),
    new MyCeffApp(),

Oppress CrashPad

Even if a separate executable is registered, Cef still starts the main executable again to create a CrashPad process. This can be detected through the program arguments at the beginning of the programs main method and easily oppressed:

if (args.Any(s => s == "--type=crashpad-handler"))

This seems to create an error that is written in the file debug.log, but doesn't seem to affect the execution of the main program.

Reinitialize after Shutdown

This is not possible with Cef. After first initialization there will always be one Cef process running in background.
But disposing CefWebBrowser controls will remove their rendering process. Don't forget to decouple from parent, otherwise the whole form might get a shutdown message (or is it just me?).

Clone this wiki locally
You can’t perform that action at this time.