We're using VB5 and I'm having a problem with my application losing focus after we unload modal forms.
We have a MDI application which has many MDI-child forms. On some of these child forms, we occasionally need to pop up a modal dialog box. If the user presses Cancel on the modal dialog box, we put up a message box to confirm that they want to quit. If they say yes, the modal form unloads. At this point, the original mdi-child form should get the focus. However, if you were running another app in the background (like Notepad), it jumps up over top of the application and has the focus. If we comment out the call to the message box, this problem doesn't happen.
I can get around the problem by manually doing a .SetFocus call after the "ModalForm.Show 1" call, but the display looks funcky. Notepad will still flash to the foreground and then our app will come back into focus. I'd prefer a better solution.
This app was ported from VB3 and we never had this problem. It only seems to happen in VB5 if the modal form is unloaded immediately after a MsgBox is displayed.
It looks like this is a VB5 bug. By the way, I'm running SP3 of VB5 and SP3 of NT 4.0.