Hide an MDI.Child from WindowList

Just how would you hide or even better, never have the MDI
Clild counted by the Windowlist property.

I have to trick it somehow, but the form must stay an

Thank you.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

if you put the form as visible = false after you load, it is loaded but not visible and does not occur on the window list.

This seems a little simple, maybe I missed something in your question
me.hide in the form activate event
As long as you set visible/hide after the form Load event of your MDIchild.
Price Your IT Services for Profit

Managed service contracts are great - when they're making you money. Yes, you’re getting paid monthly, but is it actually profitable? Learn to calculate your hourly overhead burden so you can master your IT services pricing strategy.

idcvbteamAuthor Commented:


I do not want to hide it at all,
take VB5 or 6 for example, you have an Toolbar and a Properties Bar that are MDI.Child's but yet not displayed in the Window List.

I have the same thing in my project, and do not want the toolbars displayed or even
the MDI to read it.

Thank you.
The toolbar and Poject window are not MDIchild forms, if you have a look, you can move them out of the MDI window, They are always on top forms for the MDI window, and the docking is done either by overlaying the form on top of a panel fixed on the form, or by transferring a container from a form and assigning it to a panel on the MDI window.  

You can set the toolbar docking to off so that tools and menus are not added to the MDI parent form. Otherwise you have to change the settings on the MDI Parent, But I do not have referance material for this at the moment.

Simple solution:
Add PictureBox to your MDIForm, set Alignment property to Left, and copy all controls from your form to this PictureBox.

Set the MDIChild property of the form to false.  Then use the SetParent API function to make the form a child of the MDI parent's container window.  Then you won't see it on the window list.  There are some side effects of doing it this way that you may have to subclass around... like the title bar highlighting, etc.


The other method is to build and maintain the window list yourself.  I can create a small project to show you how this is done if you wish... but it's easy.  You need to create a menu item that's invisible with an index of 0.  Then you "load" a new member of the array and make it visible as you load each new MDI Child form.

Please let me know if you want a sample.

idcvbteamAuthor Commented:


Sorry the setparent didn't work well at all, but I am interested
in your WindowList function.
Will it add new clients, and delete them once they are unloaded?
How about when their is more then 10?

What you said is that you need some floating toolbar, or whether you want it to float only inside the MDI parent form.
Why won't you open the form from the MDI form, and set the owner in the show methof to the MDIForm object?
Or rather you want an MDI child form that isn't MDI child?... this is what your question sounds like in a snap.
I've made the WindowList function.
Check this code.

You must unselect the WindowList property in the menu builder.
Create an menu array bellow that item.
Call that menu array mnuTest (to make an menu array, just put 0 in the index property).

This is the code for the menu you have just created.

Private Sub mnuTest_Click(Index As Integer)

   For iPos = 0 To Forms.Count - 1
       If Forms(iPos).Caption = mnuTest(Index).Caption Then
       End If
   Next iPos
end sub

This is the main sub that works around the menu (adds and hides menu items):

Public Sub WinList(Main As Form, Child As Form)

Dim iPos As Integer
Dim iFlag As Boolean

If Main.Controls("mnutest").ubound = 0 Then
    Load Main.mnuTest(1)
    Main.mnuTest(1).Caption = Child.Caption
    Main.mnuTest(1).Visible = True
    Exit Sub
End If
For iPos = 0 To Main.Controls("mnutest").ubound
   If Trim$(Main.mnuTest(iPos).Caption) = trim$(Child.Caption) Then
      Main.mnuTest(iPos).Visible = Not Main.mnuTest(iPos).Visible
      Exit Sub
    End If
Next iPos

Load Main.mnuTest(Main.mnuTest.ubound + 1)
Main.mnuTest(Main.mnuTest.ubound).Caption = Child.Caption
Main.mnuTest(Main.mnuTest.ubound).Visible = True

end sub

You must call this sub like this:
WinList Forms(0), Me      '--- In each form unload event

WinList Forms(0), Me      '--- before you show each form for the
                          '--- very first time.  

The WinList procedure should be in a Module.

Hope this helps

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
idcvbteamAuthor Commented:


Thank you very much,
just before I award you the points,
could you please tell me

WinList Forms(0), Me
                       '--- very first time.
What the very first time comment means?
Must I change the value on other forms?

In the MenuBuilder,
but why is it that when I run it, mnuTest is still Visible...
The windowList works well, it writes the form.caption underneath it.
How would you hide it?
Sorry I said a little mistake

You must call this sub like this:
WinList Forms(0), Me      '--- In each form unload event
                          '--- Forms(0) represents the MDI form
                          '--- For some reason doesn't accept
                          '--- the name of the form (works this
                          '--- way)

WinList Me, formChildName '--- After you show each child form
                          '--- for the very first time.
                          '--- Assuming that you call child
                          '--- forms from your MDI.
Like this in one MDI event or procedure:

frmChildOne.show          '--- To show child one form
WinList Me, formChildName '--- To call the routine that puts
                          '--- the menu in window list.

If you want more explanation before grading, say something

Hope this helps
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.