hi,
i have problem when using EnableMenuItem....
i have 2 menu items (Pause and Resume) and it's not a popup menu
what i wanted to achive is when i select the pause menu the resume menu will be grayed out and vice versa
the problem is when i pressed the pause menu and set resume menu to gray but the resume menu will not show grayed right after i set it to gray..
it will only appear gray when i move my mouse over it or the dialog box get overlapped by another window....
here is my code
mov eax,wParam
.if eax==IDM_PAUSE
invoke EnableMenuItem,hMenu,IDM_PAUSE,MF_GRAYED
invoke EnableMenuItem,hMenu,IDM_RESUME,MF_ENABLED
.elseif eax==IDM_RESUME
invoke EnableMenuItem,hMenu,IDM_PAUSE,MF_ENABLED
invoke EnableMenuItem,hMenu,IDM_RESUME,MF_GRAYED
any advice is welcome :)
Hila, I'm not positive but I think what you could do is forcel the window to redraw. Try this:
.if eax==IDM_PAUSE
invoke EnableMenuItem,hMenu,IDM_PAUSE,MF_GRAYED
invoke EnableMenuItem,hMenu,IDM_RESUME,MF_ENABLED
invoke SendMessage,hWnd,WM_PAINT,hDC,0
.elseif eax==IDM_RESUME
invoke EnableMenuItem,hMenu,IDM_PAUSE,MF_ENABLED
invoke EnableMenuItem,hMenu,IDM_RESUME,MF_GRAYED
invoke SendMessage,hWnd,WM_PAINT,hDC,0
where hDC is the handle of the device context if used, otherwise try a 0.
You might try DrawMenuBar instead, it will redraw the menu for the specified window...
invoke DrawMenuBar, [hWnd]
thanks Mark Jones and donkey reply... :bg
@donkey
ur method worked... :U
Hello
I have the same problem but I activate a menu when I clicked in a child windows...
How can I do a invoke DrawMenuBar, [hWnd] in the child windows to refresh the Menu in the main window?
Thanks