Win32 - Can't enable menu in runtime
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.
I have the following code till now:
BOOL WINAPI ModifyMenu(HMENU hMnu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR lpNewItem );
This is done all after the window is created and configured. It's done in the WinProc() funtion.
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.
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,