Win32 - Can't enable menu in runtime

This is a discussion on Win32 - Can't enable menu in runtime within the Windows Programming forums, part of the Platform Specific Boards category; Hi again, I changed a menu's propriety "Grayed" to True, and now the menu is unclickable. I wanted to enable ...

  1. #1
    Registered User
    Join Date
    Aug 2010
    Posts
    9

    Win32 - Can't enable menu in runtime

    Hi again,

    I changed a menu's propriety "Grayed" to True, and now the menu is unclickable. I wanted to enable it in runtime if a specific login is entered.

    I read some tutorials and articles, but I can't make the ModifyMenu() funtion work.

    Code:
    BOOL WINAPI ModifyMenu(HMENU hMnu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR lpNewItem );
    I have the following code till now:

    Code:
    HMENU hMenu;  //Handle to the menu
    
    hMenu = GetMenu(hWnd);  //getting handle to menu
    
    ModifyMenu(hMenu,IDR_ADMIN_CRIA_USER,MF_BYCOMMAND | MF_ENABLED,IDR_ADMIN_CRIA_USER,NULL);
    
    //IDR_ADMIN_CRIA_USER  <- Menu Item ID, the one I want to enable.
    This is done all after the window is created and configured. It's done in the WinProc() funtion.

    I don't know what to put in the last variable of the function so I've been just putting a NULL in it.

    To conclude, the proprieties I tried, were Greyed: True and Enabled: False. I can't reverse any of them with the code above.

    Can ayone give me some hints about how to work this function?

    Thanks in advance,

    keyboarder

  2. #2
    Registered User
    Join Date
    Aug 2010
    Posts
    9
    Well I solved it using:

    Code:
    EnableMenuItem(hMenu, IDR_ADMIN_CRIA_USER, MF_BYCOMMAND );
    Sorry for the posting and answeing. I have been at this since yesterday, and only when I posted I found this other funcion.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 09:25 AM
  2. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  3. Constructive Feed Back (Java Program)
    By xddxogm3 in forum Tech Board
    Replies: 12
    Last Post: 10-10-2004, 03:41 AM
  4. FILES in WinAPI
    By Garfield in forum Windows Programming
    Replies: 46
    Last Post: 10-02-2003, 06:51 PM

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