C language > Windows questions
How to disable menu item in Dialog?
(1/1)
bitcoin:
hello
I have dialog with menu. How to disable some menu item?
EnableMenuItem - don't works, probably this for usual windows.
EnableWindow(GetDlgItem(hwndDlg,MI_SOMEDATA),FALSE); - don't works, but no errors
EnableWindow(GetDlgItem(hwndDlg,MENU_ID),FALSE); - don't works, because unknown identifier (but in res file this exists).
In res:
--- Code: ---MENU "MENU_ID"
..skipped..
MENU_ID MENUEX
{
POPUP "&File", 0, 0, 0
{
MENUITEM "&Open", MI_OPEN, 0, 0
MENUITEM "&Close", MI_CLOSE, 0, 0
MENUITEM "", 0, 0|MFT_SEPARATOR, 0
MENUITEM "&Exit", MI_EXIT, 0, 0
}
POPUP "&Edit", 0, 0, 0
{
MENUITEM "&SomeAct", MI_SOMEDATA, 0, 0
}
}
--- End code ---
TimoVJL:
EnableMenuItem() should work.
--- Code: --- HMENU hMenu = GetMenu(hwnd);
EnableMenuItem(hMenu, 6002, MF_DISABLED);
--- End code ---
bitcoin:
Yes, it works, thnx. I don't know about GetMenu function..
Navigation
[0] Message Index
Go to full version