简体   繁体   中英

Visual Studio C++ weird exception when calling CefBrowserHost::CreateBrowser

I am using CEF3 (chrome embedded framework) in my win32 application, while I am running the application I get a weird error message -

在此输入图像描述

I am coming from a C# development background, and here in C++ I don't see how I can inspect my error and figure out why it's complaining about my code. How can I check the error message? If not - how you debug this kind of errors in Visual Studio?

This the code which triggering the error -

case WM_CREATE:
    {
        CefRefPtr<CefClient> clientHandler = new ClientHandler();

        RECT rect;
        GetClientRect(hWnd, &rect);

        CefWindowInfo info;
        info.SetAsChild(hWnd, rect);


        // Browser initialization settings.
        CefBrowserSettings settings;


        // Create the new browser window object asynchronously.
        std::string startupUrl = "http://www.google.com/";
        CefBrowserHost::CreateBrowser(info, clientHandler, startupUrl, settings);
    }
    break;

I don't want help in CEF3 (but I will appreciate it) I just want to know how to debug this kind of errors in Visual Studio.

The Output window of the debugger tells you what exception was thrown.

Also, you can click "Break" in the dialog that appears and VS will take you to the line on which the exception was thrown. You'll see a yellow arrow to the left of the line.

Finally, if the exception is not fatal, you can catch it and ignore it:

try
{
    ...
}
catch (const SomeException&)
{
    // do nothing
}

I had problems building in Release. The problem was that I didn't called CefInitialize at all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM