Modal MFC dialog not shown due to idle checks in CWnd::RunModalLoop
问题 Below I've put the source to CWnd::RunModal , which is the message loop run when you call CDialog::DoModal - it takes over as a nested message loop until the dialog is ended. Note that with a couple of special case exception ShowWindow is only called when the message queue is idle. This is causing a dialog not to appear for many seconds in some cases in our application when DoModal is called. If I debug into the code and put breakpoints, I see the phase 1 loop is not reached until this time.