MFC的Menu和ToolBar的问题,请教

来源:百度知道 编辑:UC知道 时间:2024/06/25 20:04:06
MFC的Menu
子窗口的button的动作,怎么可以得到父窗口的Menu,然后改变menu的某一项Item的属性(enable,gray)等

ToolBar如何使颜色变成灰色,既不可以按,然后怎么再变成有效的呢

刚接触MFC,正为这个头痛呢,请指教啊

多谢!

用这个函数试EnableMenuItem

看看用法
CMenu::EnableMenuItem
UINT EnableMenuItem( UINT nIDEnableItem, UINT nEnable );

Return Value

Previous state (MF_DISABLED, MF_ENABLED, or MF_GRAYED) or –1 if not valid.

Parameters

nIDEnableItem

Specifies the menu item to be enabled, as determined by nEnable. This parameter can specify pop-up menu items as well as standard menu items.

nEnable

Specifies the action to take. It can be a combination of MF_DISABLED, MF_ENABLED, or MF_GRAYED, with MF_BYCOMMAND or MF_BYPOSITION. These values can be combined by using the bitwise OR operator. These values have the following meanings:

MF_BYCOMMAND Specifies that the parameter gives the command ID of the existing menu item. This is the default.

MF_BYPOSITION Specifies that the parameter gives the position of the existing menu item. The first item is at position 0.

MF_DISABLED Disables