It appears that calling
LoadMenu
returns something different than what is required. I just tried a few experiments and the following code does work:
hMenu = GetMenu(hWnd); EnableMenuItem(hMenu, 0, MF_DISABLED | MF_GRAYED | MF_BYPOSITION);
*or use
CWnd Class::GetMenu() | Microsoft Docs[
^]
[edit]
The issue is that you were using the wrong system call.
LoadMenu
gets a handle to a menu resource in the executable file. Whereas
GetMenu
returns a handle to the actual menu object attached to your application's Window.
[/edit]