I am writing a Win32 plug-in DLL for a third-party MFC application. The DLL should display a modal dialog. When I do this using DialogBox() or another simple Win32 API (for example, I tried to write my own modal loop), the main application window does not redraw all the elements: it redraws the standard elements, but not the client area. Modeless dialogs display very well.

I suspect this is happening because MFC does not really have modal dialogs in the sense of Win32. It can have only one message loop, and a separate loop in DialogBox() disrupts its delicate mechanism. Here's a CodeProject article that explains this. But this CodeProject article is 9 years old, so perhaps the situation has changed since then. Can anyone shed some light on this? The application uses MFC 8 (i.e. mfc80.dll ).
Update . Here is a link to the original question ; It may contain some additional information.
Update 2 . Thanks to all; I really appreciate all the advice, it certainly helps me get a general picture of how everything fits together. The first way I'm going to learn is to use my own MFC-modal dialogs. (Since I am doing all this from Python, I will use Python bindings for MFC, pywin32 ). It will take some time; when it is ready, I update the message with the results.
Mikhail Edoshin
source share