|
-
September 25th, 2008, 08:24 PM
#1
Why do modal dialogs that are opened through a menu item’s click event process all wi
So for the past day or so I have been fixing a bug that is caused by a modal dialog. I work on an application which communicates with the server through the Windows message pump. When I use ShowDialog() to show a modal form, the message pump is blocked and none of my messages are processed, yet they do build up in the queue (expected behavior).
However, I recently noticed that if a modal form is opened through a menu item's click event, the messages are pumped to the main form and processed. Does anyone know why these messages are not blocked when a modal form is shown through a menu item's click event?
-
September 26th, 2008, 02:25 AM
#2
Re: Why do modal dialogs that are opened through a menu item’s click event process all wi
Try opening the modal dialog like this:
Code:
form.ShowDialog(this);
-
September 26th, 2008, 02:49 AM
#3
Re: Why do modal dialogs that are opened through a menu item’s click event process all wi
So, I suppose I should have mentioned that I am already doing that. Thank you for your reply though, this is the first one I have got over three different forums.
-
September 26th, 2008, 03:58 AM
#4
Re: Why do modal dialogs that are opened through a menu item’s click event process all wi
Why do you use message loop to communicate with the server? It seems to me as not a good idea. Could the communication run in its own thread without a message loop? Than no blocking should occure. If you are using poll model, I think that common Timer should work fine.
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post. 
-
September 26th, 2008, 12:06 PM
#5
Re: Why do modal dialogs that are opened through a menu item’s click event process all wi
Well, that is true. It would be better to use a receive thread and a send thread to do this, but that is not the application that I have inherited and there isnot enough time in this release to change this. We do plan on changing this behavior soon, but in the meantime I really just need to figure this one out. I have a workaround that I do not like and I really just want to understand what is special about the click event of a menu item.
-
September 26th, 2008, 12:31 PM
#6
Re: Why do modal dialogs that are opened through a menu item’s click event process all wi
the thread that creates aparticular control owns the message pump for it. is there any chance that your dialog or the menu is using a thread other than the main window thread, for creation of the dialog?
-
September 26th, 2008, 03:44 PM
#7
Re: Why do modal dialogs that are opened through a menu item’s click event process all wi
So, I think that the problem is in my application (sorry). I found some code deep down in the guts of the app that was preventing messages from being processed, even though they were being queued. Thanks everyone who tried to help here, I presented a problem that does not really make sense. Sorry for wasting your time, and thanks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|