Click or drag to resize

SelfHost Class

Version 93.1.111
SelfHost allows your application executable to be used as the BrowserSubProcess with minimal effort.
Inheritance Hierarchy
SystemObject
  CefSharp.BrowserSubprocessSelfHost

Namespace:  CefSharp.BrowserSubprocess
Assembly:  CefSharp.Core (in CefSharp.Core.dll) Version: 93.1.111.0
Syntax
public class SelfHost

The SelfHost type exposes the following members.

Constructors
  NameDescription
Public methodSelfHost
Initializes a new instance of the SelfHost class
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberMain
This function should be called from the application entry point function (typically Program.Main) to execute a secondary process e.g. gpu, plugin, renderer, utility This overload is specifically used for .Net Core. For hosting your own BrowserSubProcess it's preferable to use the Main method provided by this class. - Pass in command line args - To support High DPI Displays you should call Cef.EnableHighDPISupport before any other processing or add the relevant entries to your app.manifest
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Examples
//WinForms Example public class Program { [STAThread] public static int Main(string[] args) { Cef.EnableHighDPISupport(); var exitCode = CefSharp.BrowserSubprocess.SelfHost.Main(args); if (exitCode >= 0) { return exitCode; } var settings = new CefSettings(); //Absolute path to your applications executable settings.BrowserSubprocessPath = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; Cef.Initialize(settings); var browser = new BrowserForm(true); Application.Run(browser); return 0; } }
See Also