Thread: menu check problem

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    173

    Smile menu check problem

    Hi,

    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

    Thanks!!
    Don't laugh at me,I am just a SuperNewbie.

  2. #2
    Well, you can check or uncheck any menu item using CheckMenuItem.

    Code:
    DWORD CheckMenuItem(
      HMENU hmenu,
      UINT uIDCheckItem,
      UINT uCheck
    );
    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.

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    173
    Thanks, Mithoric, here is the code to set child window title on the main menu item
    Code:
    CLIENTCREATESTRUCT  clientcreate ;
    hMenuMain = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENUMAIN));	// Main menu
    	 hMenuMainWindow = GetSubMenu(hMenuMain, 2);			// set the menu item  are displayed
    
    clientcreate.hWindowMenu = hMenuMainWindow;
    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.

    So here isn't any menu id created for child window.
    Don't laugh at me,I am just a SuperNewbie.

  4. #4
    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.

    Eg; MF_BYPOSITION|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.

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    173
    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

    Thanks alot.
    Don't laugh at me,I am just a SuperNewbie.

  6. #6
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. allegro issues
    By mramazing in forum C++ Programming
    Replies: 1
    Last Post: 01-07-2009, 11:56 PM
  2. Menu problem, HELP!!
    By catcat28 in forum C Programming
    Replies: 1
    Last Post: 11-18-2007, 05:34 PM
  3. Menu Problem
    By vopo in forum Windows Programming
    Replies: 4
    Last Post: 10-06-2007, 07:57 PM
  4. Context Menu cursor problem
    By dWorkVan in forum Windows Programming
    Replies: 4
    Last Post: 07-14-2003, 11:42 AM
  5. pop up menu problem
    By bigtamscot in forum Windows Programming
    Replies: 5
    Last Post: 06-10-2003, 01:46 AM