Problem:
If an application creates a .NET dialog box and then tries to make it modal to an unmanaged character-base app built as graphical, it won't seem to be purely modal. This is because the text window runs in its own thread so if the dialog box is created in the main thread each window will be using a different message queue and so the text window will still be able to process messages (such as Close). There is an EnableWindow API on Windows to enable/disable message processing on a window, that could normally be used within a Dialog Box, but there may not be any equivalent in .NET so the C# code would need to access it via a platform invoke to the unmanaged API. The application would call EnableWindow(hwnd, false) when the dialog box is entered (on the Activate event maybe) and EnableWindow(hwnd, true) before the dialog box is removed (on the Closing event).
Resolution:
If an application creates a .NET dialog box and try to make it modal to an unmanaged character-base app built as graphical, it won't seem to be purely modal. This is because the text window runs in its own thread so if the dialog box is created in the main thread each window will be using a different message queue and so the text window will still be able to process messages (such as Close). There is an EnableWindow API on Windows to enable/disable message processing on a window, that could normally be used within a Dialog Box, but there may not be any equivalent in .NET so the C# code would need to access it via a platform invoke to the unmanaged API. The application would call EnableWindow(hwnd, false) when the dialog box is entered (on the Activate event maybe) and EnableWindow(hwnd, true) before the dialog box is removed (on the Closing event).