menu check problem
In MDI, when child window created and highlighted, it's name can be on the frame window menu with a "tick" in front of it,
but if I only make the child window invisible, is there any commands or syntax that remove the tick from the main menu?
I hope I make it clear :)
Well, you can check or uncheck any menu item using CheckMenuItem.
hmenu is your menu (of course) and uIDCheckItem is the id of the menu item and uCheck is if you want to check or uncheck it (MF_CHECKED or MF_UNCHECKED).
Hope that's what you wanted.
Thanks, Mithoric, here is the code to set child window title on the main menu item
Here I didn't create any menu item for child window, I think Windows could add them automatically to the menu item position "2" based on 0 is the 1st menu item.
CLIENTCREATESTRUCT clientcreate ;
hMenuMain = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENUMAIN)); // Main menu
hMenuMainWindow = GetSubMenu(hMenuMain, 2); // set the menu item are displayed
clientcreate.hWindowMenu = hMenuMainWindow;
So here isn't any menu id created for child window. :)
Well, you're in luck! Because that function also has the ability to do it by position.
I neglected to mention that before ;).
Simply specify MF_BYPOSITION as well as MF_CHECK or MF_UNCHECK.
uIDCheckItem would then be the zero based index of the menu item I think.
EDIT: Is this what you wanted? Or did I get mixed up? lol, it's pretty late. :D
That works !!! thanks, d00d :)
But is it possible to remove the child window title on the menu item??
I make child window invisible, so I should remove the title on the menu so it looks like it has been really "removed" since there isn't any id for menu item made of child window, I hope it is clear:)
Well, for that you'd want to use the DeleteMenu function I think..
BOOL DeleteMenu(HMENU hMenu,UINT uPosition,UINT uFlags);
Again, you can use the MF_BYPOSITION flag and uPosition as a zero based index.