Thread: enabling and disabling menu items

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    35

    Unhappy enabling and disabling menu items

    hi

    I have searching for a few days now to try and find out how to disable and enable menuitems becuase i am creating a chat program but when they connect i want the connect option in the menu to gray out or be disabled so they cant use it and when they disconnect for the option to be enabled so they can use it.

    i am using dev c++ and win xp pro

    thx in advance
    Theres a sucker born every minute, but a swallower is harder to find

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,263
    Code:
    BOOL EnableMenuItem(
        HMENU hMenu,
        UINT uIDEnableItem,
        UINT uEnable
    );
    
    hMenu
        [in] Handle to the menu. 
    
    uIDEnableItem
        [in] Specifies the menu item to be enabled, disabled, or
    grayed, as determined by the uEnable parameter. This
    parameter specifies an item in a menu bar, menu, or submenu.
    
    uEnable
        [in] Controls the interpretation of the uIDEnableItem 
    parameter and indicate whether the menu item is enabled, 
    disabled, or grayed. This parameter must be a combination of 
    either MF_BYCOMMAND or MF_BYPOSITION and MF_ENABLED, 
    MF_DISABLED, or MF_GRAYED. 
    
    MF_BYCOMMAND
    Indicates that uIDEnableItem gives the identifier of the menu 
    item. If neither the MF_BYCOMMAND nor MF_BYPOSITION flag is 
    specified, the MF_BYCOMMAND flag is the default flag.
    
    MF_BYPOSITION
    Indicates that uIDEnableItem gives the zero-based relative 
    position of the menu item.
    
    MF_DISABLED
    Indicates that the menu item is disabled, but not grayed, so it 
    cannot be selected.
    
    MF_ENABLED
    Indicates that the menu item is enabled and restored from a 
    grayed state so that it can be selected.
    
    MF_GRAYED
    Indicates that the menu item is disabled and grayed so that it 
    cannot be selected.
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    poopy_pants2
    Guest

    Wink

    thx for the code no one its work well now i can carry on

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MDI and MENU Problem
    By Marc in forum Windows Programming
    Replies: 3
    Last Post: 02-21-2004, 06:59 PM