how to connect to the MFC CEF

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

how to connect to the MFC CEF

Postby ninja2 » Mon Sep 21, 2015 2:08 pm

Hello!
CEF is trying to connect to the MFC but nothing happens.
I do so:
1. Create a project, IFC
2. copy the folder including a header
3. To copy all the debug folder
4. CPP file prescribe
Code: Select all
#pragma comment(lib,"libcef_dll_wrapper.lib")
#pragma comment(lib,"libcef.lib")
#pragma comment(lib,"cef_sandbox.lib")


5. connect the header files in the file beginning cpp
Code: Select all
#include "simple_handler.h"
#include "include/cef_browser.h"
#include "include/cef_command_line.h"
#include "include/wrapper/cef_helpers.h"


6. copy files to a project simple_handler.h and simple_handler.cpp
7. add to the function OnInitDialog code
Code: Select all
CEF_REQUIRE_UI_THREAD();

  // Information used when creating the native window.
  CefWindowInfo window_info;

#if defined(OS_WIN)
  // On Windows we need to specify certain flags that will be passed to
  // CreateWindowEx().
  window_info.SetAsPopup(NULL, "cefsimple");
#endif
 
  // SimpleHandler implements browser-level callbacks.
  CefRefPtr<SimpleHandler> handler(new SimpleHandler());

  // Specify CEF browser settings here.
  CefBrowserSettings browser_settings;

  std::string url;

  // Check if a "--url=" value was provided via the command-line. If so, use
  // that instead of the default URL.
  CefRefPtr<CefCommandLine> command_line =
      CefCommandLine::GetGlobalCommandLine();
  url = command_line->GetSwitchValue("url");
  if (url.empty())
    url = "http://www.google.com";

  // Create the first browser window.
  CefBrowserHost::CreateBrowser(window_info, handler.get(), url,
                                browser_settings, NULL);
         

collect application, everything is going without errors, but when the application crashes. The debugger shows an unhandled exception.

How to connect in MFC connect CEF, it does not work :)
ninja2
Newbie
 
Posts: 8
Joined: Mon Sep 21, 2015 1:47 pm

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 90 guests