menu

This is a discussion on menu within the Windows Programming forums, part of the Platform Specific Boards category; Is there a simple message to send a menu(from resource) to see if the menu item is checked?...

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    38

    menu

    Is there a simple message to send a menu(from resource) to see if the menu item is checked?

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Code:
    (GetMenuState(hMenu, IDCMD_PLAYCHICKEN, MF_BYCOMMAND) & MF_CHECKED)

  3. #3
    Registered User
    Join Date
    Dec 2004
    Posts
    38
    Heh, thanks that worked.

  4. #4
    Registered User
    Join Date
    Dec 2004
    Posts
    38
    What do you do when you specify the MF_BYPOSITION flag?I am not really sure where to use MF_BYCOMMAND or MF_BYPOSITION like MF_BYCOMMAND sometimes works and I just used the menu identifier for the 2nd paramater, what do I put for MF_BYPOSITION?

  5. #5
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    You just use the zero-based position of the menu item. For example, if you wanted to check the second menu item, you would use the value 1. I imagine it would usually be more convernient to use MF_BYCOMMAND with the identifier.

  6. #6
    Registered User
    Join Date
    Dec 2004
    Posts
    38
    maybe this is unrelated to a CheckMenuItem() problem but why doesnt this work?
    Code:
    	case WM_CLOSE:
    		if(GetFocus() == hwndtreeparent){
    			HMENU hMenu;
    			hMenu = GetMenu(hwnd);
    			CheckMenuItem(hMenu, IDM_VIEW_WORK, MF_UNCHECKED);
    			ShowWindow(hwndtreeparent, SW_HIDE);
    			return 0;
    		}
    	break;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 03:25 PM
  2. Replies: 2
    Last Post: 03-05-2009, 09:25 AM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 03:41 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21