Page 1 of 1

What problem causes the createbrowser to return false?

PostPosted: Mon May 17, 2021 2:57 am
by lin123
When I debugged, I found that the createbrowser interface returned false. What's the problem? The following is my code, I hope you can help me deal with the problem:
Code:
WebPush *web = new WebPush();
web->Create(IDD_DIALOG3);
CefWindowInfo window_info;
CRect rt;
rt.left = 0;
rt.right = 1000;
rt.top = 0;
rt.bottom = 500;
window_info.SetAsChild(GetSafeHwnd(), rt);
CefRefPtr<SimpleHandler> handler(new SimpleHandler(true));
CefBrowserSettings browser_settings;
std::string url;
url = "http://www.Google.com";
bool test = CefBrowserHost::CreateBrowser(window_info, handler.get(), url, browser_settings, NULL, NULL);
web->SetWindowPos(this, g_rect[1].left, g_rect[1].top, g_rect[1].right - g_rect[1].left, g_rect[1].bottom - g_rect[1].top, SWP_SHOWWINDOW);

Re: What problem causes the createbrowser to return false?

PostPosted: Mon May 17, 2021 9:00 am
by ndesktop
Look into CefBrowserHost::CreateBrowser implementation. Other than incompatibilities (settings.size != sizeof(cef_browser_settings_t)) or invalid state, there is no fail.
Run your executable with --enable-logging --v=1 to see what error messages are displayed.

Re: What problem causes the createbrowser to return false?

PostPosted: Wed May 19, 2021 8:50 pm
by lin123
I use CEF_ binary_ 90.6.5_ In the development package of Windows 32, before calling the interface of createbrowser, do I have to call the interface of cefinitialize to initialize?

Re: What problem causes the createbrowser to return false?

PostPosted: Wed May 19, 2021 9:07 pm
by amaitland
Yes, you must call CefInitialze and when you are finished CefShutdown

https://bitbucket.org/chromiumembedded/ ... t-function