CefInitialize won't work with mfc dll

I want to use Xromium Embeded Framework in mfc dll. So I created an mfc test exe and tested the minimalist cef implementation (which worked). The next step was to do the same with the test mfc dll. The code is pretty much the same, but the cef browser window will not appear.

The application hangs at CefInitialize () and won't return. After debugging, I found it was stuck in the WaitForSingleObject / WaitForMultipleObject windows.

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;
}

      

The same implementation works if used directly in the mfc exe.

+3


source to share


1 answer


GetModuleHandle

returns the base for the exe, not the dll. You might want to hide the dll database:



BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, void *reserved) 

      

-1


source







All Articles