
Modeless child form and main window focus
In my app, I have a find/replace window that I show using:
Me.Show vbModeless, frmMain
This is done from frmFindReplace in a routine called ShowWindow. frmMain is
an MDIForm and frmFindReplace is a normal Form with ShowInTaskbar set to
False and the BorderStyle set to 3 - Fixed Dialog. This works just fine in
that the find/replace dialog is shown modelessly, but always stays in front
of the main window. The only thing is, when you set the focus to the
find/replace window, the main window loses focus (as desired) but the
taskbar button is also deselected indicating the app lost focus, when it
hasn't (not as desired). If you try this in Notepad and other apps, the
taskbar button stays selected even though the main window has lost focus.
Does anyone know how to reproduce this in VB? I've tried other styles of
borders for frmFindReplace, and switching frmMain with a normal Form, but
nothing I've tried makes any difference.
- Doug