I am trying to make CEF to work as an activeX control. I have had some (minor) successes with CEF1... but I have not been abe to successfully display a broswer, close it down and re-open it without subsequent crashes. I have even tried to unload the activeX after use ( by calling ::CoFreeUnusedLibraries() ) but that did not help.
I have read somewhere in the forum that if I need multiple browsers I would be better off with CEF3... being of a gullible and experimental nature, I have had a go. I have managed to display the browser but it freezes right away and spawns the same executable (which has the good taste of dying quickly).
Here is the code I am using:
- Code: Select all
bool CMyChromiumControlApp::InitialiseChromium()
{
CString strLocales(_T("C:\\ProgramData\\MyCtrl\\Locales"));
CefSettings AppSettings;
AppSettings.multi_threaded_message_loop = true;
CefString(&AppSettings.locales_dir_path ) = (LPCTSTR) strLocales;
// Initialize CEF.
#ifdef CEF3
m_CefApp = new ClientApp;
AppSettings.pack_loading_disabled = true;
HINSTANCE hInstance = GetModuleHandle(NULL) ;
CefMainArgs main_args(hInstance );
bool bResult = CefInitialize(main_args,AppSettings, m_CefApp.get());
#else
bool bResult = CefInitialize(AppSettings, m_CefApp);
#endif
return bResult;
}
Clearly the way I call the constructor of CefMainArgs is to blame... but I am short of ideas.
Any tips on integrating Activex are welcome by the way... I know a few you of you have done it... and yes I'll share the code!
Regards
Jerry