Skip to content

Commit 785e893

Browse files
committed
WinForms/WPF - Display MessageBox when Cef.Initialzie returns false
cefsharp/CefSharp#4668
1 parent d29c915 commit 785e893

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

CefSharp.MinimalExample.WinForms/Program.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,14 @@ public static int Main(string[] args)
3838
settings.CefCommandLineArgs.Add("enable-usermedia-screen-capturing");
3939

4040
//Perform dependency check to make sure all relevant resources are in our output directory.
41-
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
41+
var initialized = Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
42+
43+
if (!initialized)
44+
{
45+
MessageBox.Show("Cef.Initialized failed, check the log file for more details.");
46+
47+
return 0;
48+
}
4249

4350
Application.EnableVisualStyles();
4451
Application.Run(new BrowserForm());

CefSharp.MinimalExample.Wpf/App.xaml.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,14 @@ public App()
3737
if (!Cef.IsInitialized)
3838
{
3939
//Perform dependency check to make sure all relevant resources are in our output directory.
40-
Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
40+
var initialized = Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
41+
42+
if(!initialized)
43+
{
44+
MessageBox.Show("Cef.Initialized failed, check the log file for more details.");
45+
46+
Shutdown();
47+
}
4148
}
4249
}
4350
}

0 commit comments

Comments
 (0)