BUG: MFC Dialog Explicitly Owned by the Desktop Window Disables the Desktop (257812)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
This article was previously published under Q257812 SYMPTOMS
When you attempt to explicitly specify the desktop as the owner window for a modal MFC dialog, this action results in a system that does not respond to mouse events. If you click on different controls in the dialog box or on other windows on the desktop, there is no effect. To exit, you must dismiss the dialog box through the keyboard command.
CAUSE
The MFC code for the CDialog::DoModal function simulates modal dialogs by disabling the owner window of the dialog box. Under normal circumstances, this window is either an application window or sometimes NULL. The MFC code for CDialog::DoModal fails to test whether the dialog's owner is the desktop before MFC disables it.
RESOLUTION
The easiest workaround is to not explicitly specifying the desktop as the owner of a modal dialog. Instead, accept the default NULL argument which works fine as a default in most cases. However, if you want the desktop to own your dialog then you can override CDialog::DoModal in your dialog class implementation. Note that this is a somewhat difficult task.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 12/11/2003 |
---|
Keywords: | kbBug kbDlg kbpending KB257812 |
---|
|