Enumerating MDIList Menu Item at Run-Time

P

pa.singer

I have an MDIList menu item that I want to enumerate at run-time and
possibly change the text shown for some of the MDI children included in
that list. When I enumerate the collection for that menu item, none of
the open MDI child windows show in the list although they are clearly
there in the actual drop-down of the menu item. Does anyone know how I
can enumerate the menu item that contains the MDIList at run-time and
change the text associated with some of the MDI children in that list?

Thank you.
 
V

VJ

The best way to do this is , enumrate the MDI children open, and then change
the text.. something like below... ( I am assuming you are doing the code in
your MDI form)

Dim frmChild as Form

For Each frmChild In Me.MdiChildren

If typeof frm Is Form1 then
frm.Text = "My New Text"
else if typeof frm Is Form2 then
frm.Text = "My Second Text"
else if...

end if

Next frm

VJ
 
P

pa.singer

Thanks for the feedback. Unfortunately I want to be able to keep the
text as is on the form title bar and only change the text that shows in
the menu's drop-down items. Under VB6 I was able to do just that using
miscellaneous APIs (GetMenu, GetSubMenu, etc.) but I'm not having any
success with those APIs within .Net so far.
 
V

VJ

uhmm...interesting.. Yes do remember the VB6.0 days... maybe there is a
Reason they removed it .NET. I assume you have tried the InterOp way, and it
did not work.. ?

VJ
 
P

pa.singer

Yeah I know I'm in trouble as soon as the GetMenuItemCount API
completes because although that returns without an error, it also
returns with a crazy high number for menu items. The GetMenuItemInfo
that is used next fails with a System.AccessViolationException -
Attempted to read or write protected memory.....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top