Suppose a main form A and a modal dialog B.
I launch B from a thread (using invoke) as a modal dialog. The dialog is correctly shown and it is launched using ShowDialog(parent), where parent is form A.
When I close B, the main dialog A is not responding properly to some events, such as mouse clicks. This issue is only reproduced under the following circumstances:
- The code is compiled开发者_高级运维 using .NET framework 1.1 profile
- The code is executed in a Windows 7 x64 machine
Once I close the dialog, the following symptoms occur:
- Form A does not respond to some mouse clicks, but respond to mouse moves (buttons are highlighted on mouse move).
- The main window close button is highlighted on mouse hover, also can be clicked, but the form is not closed.
- New modal dialogs are not modal anymore.
- Dialogs that have the property
StartPosition=CenterParent
, are not centered, they are shown in the top left corner on the screen.
I was unable to reproduce the problem in other machine. Also, If I compile the code using .NET 2.0 or higher, the problem is not reproduced.
Any suggestion to solve this issue? I need 1.1 for my application. Any call I could perform to restore the event queue?
Thanks in advance.
Ok finally it was a threading issue. I changed the calling code outside of a thread and it worked.
It is quite annoying because sometimes we need to show this dialog from a thread, but in the case of .NET 1.1 and x64 machines it seems to have some troubles with invokes and multi threading.
In any case, if the code is compiled with .NET 2.0 or higher (so works in real x64), the problem is gone.
精彩评论