网站首页  词典首页

请输入您要查询的函数:

 

术语 enablemenuitem
释义 EnableMenuItem
语法:
BOOL EnableMenuItem( HMENU hMenu,
UINT uIDEnableItem,
UINT uEnable
);
EnableMenuItem函数
该功能使EnableMenuItem,禁用或灰色指定的菜单项。
参数
hMenu
[in]句柄菜单。
uIDEnableItem
[in]指定的菜单项被启用,禁用,或变灰,由uEnable参数确定。该参数指定的菜单栏,菜单或子菜单项目。
uEnable
[in]控制的uIDEnableItem参数的解释和说明是否该菜单项启用,禁用,或变灰。此参数必须是一方MF_BYCOMMAND或MF_BYPOSITION和MF_ENABLED,MF_DISABLED,或MF_GRAYED组合。
MF_BYCOMMAND
指示uIDEnableItem给出了菜单项的标识符。如果既不MF_BYCOMMAND或MF_BYPOSITION标志指定,MF_BYCOMMAND标志是默认的标志。
MF_BYPOSITION
指示uIDEnableItem使从零开始的菜单项的相对位置。
MF_DISABLED
表示该菜单项被禁用,但不灰色,所以它不能被选中。
MF_ENABLED
表示该菜单项被启用,从灰色状态,这样可以选择恢复。
MF_GRAYED
表示该菜单项被禁用,变灰,使其不能被选中。
返回值
返回值指定菜单项以前的状态(这是不是MF_DISABLED,MF_ENABLED,或MF_GRAYED)。如果该菜单项不存在,则返回值为-1。
备注
应用程序必须使用MF_BYPOSITION标志来指定正确的菜单句柄。如果菜单句柄指定菜单栏,在菜单栏上的顶级菜单项目(1项)受影响。要设置在下拉一个项的状态下拉菜单或子菜单的位置,应用程序必须指定一个句柄下拉菜单或子菜单下拉。
当应用程序指定了MF_BYCOMMAND标志,系统检查所有项目,由指定的菜单处理一些菜单打开子菜单。因此,除非重复的菜单项存在,指定菜单句柄菜单栏就足够了。
该InsertMenu,InsertMenuItem,LoadMenuIndirect,ModifyMenu,并SetMenuItemInfo功能,还可以设置状态(启用,禁用或灰色的菜单项)。
当您更改窗口菜单,在菜单栏不会立即更新。要强制更新,调用DrawMenuBar。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
UnicodeImplemented为Unicode版本。
参见
菜单,DrawMenuBar,GetMenuItemID,InsertMenu,InsertMenuItem,LoadMenuIndirect,ModifyMenu,SetMenuItemInfo,WM_SYSCOMMAND的
==英文原文==EnableMenuItem Function
The EnableMenuItem function enables, disables, or grays the specified menu item.
Syntax
BOOL EnableMenuItem( HMENU hMenu,
UINT uIDEnableItem,
UINT uEnable
);
Parameters
hMenu
[in] Handle to the menu.
uIDEnableItem
[in] Specifies the menu item to be enabled, disabled, or grayed, as determined by the uEnable parameter. This parameter specifies an item in a menu bar, menu, or submenu.
uEnable
[in] Controls the interpretation of the uIDEnableItem parameter and indicate whether the menu item is enabled, disabled, or grayed. This parameter must be a combination of either MF_BYCOMMAND or MF_BYPOSITION and MF_ENABLED, MF_DISABLED, or MF_GRAYED.
MF_BYCOMMAND
Indicates that uIDEnableItem gives the identifier of the menu item. If neither the MF_BYCOMMAND nor MF_BYPOSITION flag is specified, the MF_BYCOMMAND flag is the default flag.
MF_BYPOSITION
Indicates that uIDEnableItem gives the zero-based relative position of the menu item.
MF_DISABLED
Indicates that the menu item is disabled, but not grayed, so it cannot be selected.
MF_ENABLED
Indicates that the menu item is enabled and restored from a grayed state so that it can be selected.
MF_GRAYED
Indicates that the menu item is disabled and grayed so that it cannot be selected.
Return Value
The return value specifies the previous state of the menu item (it is either MF_DISABLED, MF_ENABLED, or MF_GRAYED). If the menu item does not exist, the return value is -1.
Remarks
An application must use the MF_BYPOSITION flag to specify the correct menu handle. If the menu handle to the menu bar is specified, the top-level menu item (an item in the menu bar) is affected. To set the state of an item in a drop-down menu or submenu by position, an application must specify a handle to the drop-down menu or submenu.
When an application specifies the MF_BYCOMMAND flag, the system checks all items that open submenus in the menu identified by the specified menu handle. Therefore, unless duplicate menu items are present, specifying the menu handle to the menu bar is sufficient.
The InsertMenu , InsertMenuItem , LoadMenuIndirect , ModifyMenu , and SetMenuItemInfo functions can also set the state (enabled, disabled, or grayed) of a menu item.
When you change a window menu, the menu bar is not immediately updated. To force the update, call DrawMenuBar .
Function Information
Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 3.1
UnicodeImplemented as Unicode version.
See Also
Menus , DrawMenuBar , GetMenuItemID , InsertMenu , InsertMenuItem , LoadMenuIndirect , ModifyMenu , SetMenuItemInfo , WM_SYSCOMMAND
==原始网址==http://msdn.microsoft.com/en-us/library/ms647636(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 11:23:15