【发布时间】:2014-08-20 12:36:46
【问题描述】:
我想在 mfc dll 中使用 Chromium 嵌入式框架。因此,我创建了一个 mfc 测试 exe 并测试了一个简约的 cef 实现(有效)。我的下一步是用一个测试 mfc dll 做同样的事情。代码几乎一样,但是 cef 浏览器窗口不会出现。
应用程序在 CefInitialize() 中挂起并且不会返回。调试后发现卡在了WaitForSingleObject/WaitForMultipleObject windows api中。
BOOL CMyBrowserDllApp::InitInstance()
{
HINSTANCE hInstance = GetModuleHandle(NULL);
CefMainArgs main_args(hInstance);
CefSettings settings;
settings.no_sandbox = true;
settings.multi_threaded_message_loop = true;
// Execute the secondary process, if any.
int exit_code = CefExecuteProcess(main_args, cefApplication.get(), NULL);
if (exit_code >= 0)
return exit_code;
if(!CefInitialize(main_args, settings, cefApplication.get(), NULL))
{
OutputDebugStringA("Error: CefInitialize failed");
}else
OutputDebugStringA("Info: CefInitialize succeeded");
CWinApp::InitInstance();
return TRUE;
}
如果直接在 mfc exe 中使用,同样的实现也可以工作。
【问题讨论】:
-
也许是静态或动态链接MFC的问题
-
两个项目都静态链接到 mfc dll。
-
我遇到了同样的问题,但我发现您在 CEF 论坛上获得了帮助。 Here's a link to the answer 其他陷入同样困境的人:
标签: mfc chromium-embedded