I have an MDI application with a child form showing. When I then pop up a modal form, such as a file open dialog box, when the user double-clicks a filename it is selected, the dialog box goes away but then a click is registered by the child form underneath where the mouse happens to be, possible starting another action on the child form.

I need a way to flush any pending mouse clicks when I get back to the child form so this "bleed through" doesn't happen. I am hoping that there is an API call that will do this... Do any of you know of one, or some other method to fix this problem?

(I have tried disabling the child form before popping up the modal form and then re-enabling it a second after closing the top form. This kind of works but it causes the MDI form to disappear behind any other application that is running for a second and then re-appear. Not good!)