I'm not certain how to further troubleshoot.
Modified SimpleApp.cc constructor:
- Code: Select all
SimpleApp::SimpleApp (HWND parent_window_HWND, RECT parent_window_RECT)
{
m_parent_window_HWND = parent_window_HWND;
m_parent_window_RECT = parent_window_RECT;
}
Modified SimpleApp.cc initialization (why is this not being invoked by CefInitialize?):
- Code: Select all
void SimpleApp::OnContextInitialized()
{
CEF_REQUIRE_UI_THREAD();
CefRefPtr<CefCommandLine> command_line = CefCommandLine::GetGlobalCommandLine();
CefRefPtr<SimpleHandler> handler(new SimpleHandler(use_views));
CefBrowserSettings browser_settings;
std::string url;
url = command_line->GetSwitchValue("url");
if (url.empty())
url = "file://C:/Users/john_/Documents/VST_SDK_3.6.14/my_plugins/againTestCEF3/Controller/EditorView/CEF3Main.html";
CefWindowInfo window_info;
#if defined(OS_WIN)
window_info.SetAsChild(m_parent_window_HWND, m_parent_window_RECT);
#endif
CefBrowserHost::CreateBrowser(window_info, handler, url, browser_settings,
nullptr, nullptr);
}
Plugin dll entry:
- Code: Select all
BOOL WINAPI DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpvReserved*/)
{
switch(dwReason)
{
case DLL_PROCESS_ATTACH:
{
ghInst = hInstance;
m_UI_thread_event = CreateEvent
(
NULL, // default security attributes
TRUE, // manual-reset event
FALSE, // initial state is nonsignaled
TEXT("UI_Thread_Event") // object name
);
//
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Carlsound::againCEF3Test::UiThread, (void*)NULL, 0, 0);
break;
}
Plugin dll initialization:
- Code: Select all
BOOL Carlsound::againCEF3Test::Init(HWND hWnd, int left, int top, int width, int height)
{
m_parent_window = hWnd;
m_window_left = left;
m_window_top = top;
m_window_width = width;
m_window_height = height;
//
SetEvent(m_UI_thread_event);
Plugin dll UI thread:
- Code: Select all
BOOL WINAPI Carlsound::againCEF3Test::UiThread()
{
int result = 0;
DWORD dwEvent = 0;
dwEvent = WaitForSingleObject(m_UI_thread_event, INFINITE);
if(WAIT_OBJECT_0 == dwEvent)
{
CefMainArgs m_main_args;
CefSettings m_settings;
void* m_sandbox_info = nullptr;
CefMainArgs main_args(ghInst);
CefEnableHighDPISupport();
int exit_code = CefExecuteProcess(main_args, nullptr, m_sandbox_info);
if (exit_code >= 0)
{
return exit_code;
}
//
m_child_window = RegisterWindow(ghInst, m_parent_window, SW_SHOWNORMAL);
//
m_settings.no_sandbox = TRUE;
m_settings.multi_threaded_message_loop = TRUE;
GetClientRect(m_child_window, &m_window_rect);
CefRefPtr<SimpleApp> m_app(new SimpleApp(m_child_window, m_window_rect));
CefString(&m_settings.browser_subprocess_path) =
"C:\\Users\\john_\\Documents\\VST_SDK_3.6.14\\my_plugins\\build_x64\\Debug\\againTestCEF3_Subprocesses_x64.exe";
CefInitialize(main_args, m_settings, m_app.get(), m_sandbox_info);
try
{
CefRunMessageLoop(); // keeps throwing an exception
}
catch (const std::exception& e)
{
}
Sub-processes exe entry:
- Code: Select all
int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow)
{
UNREFERENCED_PARAMETER (hPrevInstance);
UNREFERENCED_PARAMETER (lpCmdLine);
int result (0);
CefMainArgs main_args(hInstance);
int exit_code = CefExecuteProcess(main_args, nullptr, m_sandbox_info);
if (exit_code >= 0)
{
return exit_code;
}
//CefInitialize(main_args, m_settings, nullptr, m_sandbox_info);
//CefRunMessageLoop();
//CefShutdown();
//
return result;
}