-
Enabling a menu
Hey guys, im trying to enable a menu item that is by default MFS_GRAYED, that is my shot:
Code:
MENUITEMINFO a;
a.fMask = MIIM_STATE;
GetMenuItemInfo(hMenu,ID_FILE_SAVERESULT,false,&a);
a.fState = MFS_ENABLED;
SetMenuItemInfo(hMenu,ID_FILE_SAVERESULT,false,&a);
But it dont change the menu item status.
What im doeing wrong?
-
MSDN:
Code:
lpmii
[in, out] Pointer to a MENUITEMINFO structure that specifies the information to retrieve and receives information about the menu item. Note that you must set MENUITEMINFO.cbSize to sizeof(MENUITEMINFO) before calling this function.
-
But theMSDN example code is exactly as mine, the sctruct defined as MENUITEMINFO and the function member as "&a".
Oh... and if i set cbsize to (sizeof)a, the situation continues the same
-
Check return values of API's, getlasterror.
-
It said "a menu item wasnt found". So i realized that the menu was not hMenu, it was hSubMenu, but not the error that it return is "incorrect paramter").
Sorry if the error messages are not exactly it, but they appear in portuguese here, and i try to translate it :P