Ok, here is some more information:
Cef verison: 78.3.9
I integrated the CEF message loop in my MFC message loop using "CefDoMessageLoopWork".
The dialog box is modal. It has a default pushbutton that should be triggered by the "enter" key.
There is no browser window created yet, and thus no renderer subprocesses are active yet. However, "CefInitialize" was called already which spawns about two (non renderer) sub processes.
So there is no relationship between the browser window (not in existence yet) and the dialog box at all. If I remove the call "CefInitialize" and thus block the spawning of sub processes,
then the dialog box performs normally again (the "enter" button triggers the default button at first try). It's clear that the existence of the sub processes affect the behavior of the dialog box default button. Whether this is a focus issue was just an assumption. It might as well be something else as the "Window focus logger" program seems to indicate that the focus is never removed from the dialog box to another window. That makes sense because the sub processes show no window at all. I created a separate subprocess executable. However, this is just a very basic win32 program that never displays a window. See code below:
- Code: Select all
int APIENTRY _tWinMain(_In_ HINSTANCE /*hInstance*/,
_In_opt_ HINSTANCE /*hPrevInstance*/,
_In_ LPTSTR /*lpCmdLine*/,
_In_ int /*nCmdShow*/)
{
Cef cef;
return cef.Initialize(); //return value of ::CefExecuteProcess
}
So what happens sometimes when pressing the "enter" key? Windows generates the same error sound as when you do a mouse click on an underlying window (you must first take care of the modal dialog box) and then nothing happens. Sometimes when pressing "enter" the default push button does get triggered and the dialog closes (as it should). This inconsistent behavior does not occur when there are no CEF sub processes running. The whole time the dialog box seems to be the active window (the border is highlighted), so no visual clues there.
My first thought was that maybe upon spawning of the sub process some additional command line argument should be added, but I'm not really sure.