Error in cef in c# windows forms

0

good afternoon everybody

I was trying to upgrade my GUI in c# by using the webBrowser component but it doesnt support everything and the file doesnt show as it should be

so i tried using ChromiumWebBrowser which appeared to be a great solution

but when i compiled the project it justs exits without any error

 public ChromiumWebBrowser chromeBrowser;

    public void InitializeChromium()
    {
        CefSettings settings = new CefSettings();

        // Note that if you get an error or a white screen, you may be doing something wrong !
        // Try to load a local file that you're sure that exists and give the complete path instead to test
        // for example, replace page with a direct path instead :
        // String page = @"C:\Users\SDkCarlos\Desktop\afolder\index.html";

        String page = string.Format(@"{0}\html-resources\html\mainmenu.html", Application.StartupPath);
        //String page = @"C:\Users\SDkCarlos\Desktop\artyom-HOMEPAGE\index.html";

        if (!File.Exists(page))
        {
            MessageBox.Show("Error The html file doesn't exists : " + page);
        }

        // Initialize cef with the provided settings
        Cef.Initialize(settings);
        // Create a browser component
        chromeBrowser = new ChromiumWebBrowser(page);

        // Add it to the form and fill it to the form window.
        this.Controls.Add(chromeBrowser);
        chromeBrowser.Dock = DockStyle.Fill;

        // Allow the use of local resources in the browser
        BrowserSettings browserSettings = new BrowserSettings();
        browserSettings.FileAccessFromFileUrls = CefState.Enabled;
        browserSettings.UniversalAccessFromFileUrls = CefState.Enabled;
        chromeBrowser.BrowserSettings = browserSettings;
    }

and this

public void InitializeChromium()
    {
        CefSettings settings = new CefSettings();
        Cef.Initialize(settings);
        chromeBrowser = new ChromiumWebBrowser("http://stackoverflow.com/");
        this.Controls.Add(chromeBrowser);
        chromeBrowser.Dock = DockStyle.Fill;
    }

and the function is called after InitializeComponent

This is what shows after exiting

The thread 'vshost.NotifyLoad' (0x7bc) has exited with code 0 (0x0).
The thread '<No Name>' (0x315c) has exited with code 0 (0x0).
The thread 'vshost.LoadReference' (0x1004) has exited with code 0 (0x0).
'cefTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'c:\users\dark_\onedrive\documents\visual studio 2012\Projects\cefTest\cefTest\bin\x64\Debug\cefTest.exe', Symbols loaded.
'cefTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'c:\users\dark_\onedrive\documents\visual studio 2012\Projects\cefTest\cefTest\bin\x64\Debug\CefSharp.Core.dll'
'cefTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'c:\users\dark_\onedrive\documents\visual studio 2012\Projects\cefTest\cefTest\bin\x64\Debug\CefSharp.WinForms.dll'
'cefTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'c:\users\dark_\onedrive\documents\visual studio 2012\Projects\cefTest\cefTest\bin\x64\Debug\CefSharp.dll'
The program '[8200] cefTest.vshost.exe: Managed (v4.0.30319)' has exited with code -2147483645 (0x80000003).

hope that someone can help

c#
chromium-embedded
asked on Stack Overflow Jul 27, 2016 by Grim Reaper • edited Jul 27, 2016 by Grim Reaper

1 Answer

0

Make sure you are using same .Net FrameWork (4.5.2) or more

answered on Stack Overflow Aug 22, 2017 by AbeerAhdab

User contributions licensed under CC BY-SA 3.0