Thread: Disable menu items.

  1. #1
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396

    Disable menu items.

    I am trying to figure out how to disable a menu item that is another popup. I would like to disable the 'File|Data' menu item instead of having to disable all the items seperately listed in this popup. I have attached a pict. for clarity.

    Hopefully, I have explained myself adequately.

    This works:
    Code:
    	EnableMenuItem(hMenu, IDM_FILE_DATA_INPUT, MF_GRAYED);
    	EnableMenuItem(hMenu, IDM_FILE_DATA_OUTPUT, MF_GRAYED);
    but this doesn't
    Code:
    	EnableMenuItem(hMenu, IDM_FILE_DATA, MF_GRAYED);
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  2. #2
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    try MF_GRAYED|MF_DISABLED as a parameter, not sure if it will work, but it's worth the try

    http://msdn.microsoft.com/library/de...lemenuitem.asp

    check that out if you haven't already

  3. #3
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    Well I guess I should have said so but I tried MF_DISABLED also to no avail.

    My browser is giving me some difficulties, so I can't see the link but when I get to my broadband connection tomorrow I'll give it a look!
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Try
    GetSubMenu() to find the Data popup menu handle, then disable it

    or
    (as a long shot)
    EnableMenuItem(hMenu, IDM_FILE_DATA, MF_BYCOMMAND|MF_GRAYED);//use the popups ID

    or

    try the 'by position' flag for the DATA item (3 I think, zero based counting from the top down?)
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    Thanks Novacaine,

    When I get off work I'll give those a try. I had some spyware that wouldn't let me view the link of MS site.
    Favorite Quote:

    >For that reason someone invented C++.
    BLASPHEMY! Begone from my C board, you foul lover of objects, before the gods of C cast you into the void as punishment for your weakness! There is no penance for saying such things in my presence. You are henceforth excommunicated. Never return to this house, filthy heretic!



Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. HELP!!!!emergency Problem~expert please help
    By unknowppl in forum C++ Programming
    Replies: 9
    Last Post: 08-21-2008, 06:41 PM
  4. HELP!!!!emergency ~expert please help
    By unknowppl in forum C Programming
    Replies: 1
    Last Post: 08-19-2008, 07:35 AM
  5. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 03:41 AM