术语 | getmenustate |
释义 | GetMenuState 语法: UINT GetMenuState( HMENU hMenu, UINT uId, UINT uFlags ); GetMenuState功能 该GetMenuState函数检索菜单与指定菜单项关联的标志。如果该菜单项打开一个菜单,这个函数也返回子菜单中的项目数。 参数 hMenu [in]的菜单句柄包含菜单项,其标志是要检索。 的UID [in]指定的菜单项为标志的菜单要检索,由uFlags参数确定。 uFlags [in]指定的UID参数如何解释。此参数可以是下列值之一。 MF_BYCOMMAND 表明,uid参数给出了菜单项的标识符。该MF_BYCOMMAND标志是,如果既不是MF_BYCOMMAND或MF_BYPOSITION标志指定的默认。 MF_BYPOSITION 表明,uid参数给出了基于零的菜单项的相对位置。 返回值 如果指定的项目不存在,则返回值为-1。 如果该菜单项打开一个菜单,低返回值的命令字节包含菜单与该项目有关的旗帜,以及高字节包含的子菜单项数目的项目打开。 否则,返回值是一个标志的菜单面具(位或)。以下是菜单的菜单项关联的标志。 MF_CHECKEDA选中标记放在旁边的项目(下拉菜单,子菜单和快捷菜单只)。 MF_DISABLEDThe项目被禁用。 MF_GRAYEDThe项目是残疾人和变灰。 MF_HILITEThe项目突出。 MF_MENUBARBREAKThis是一样的MF_MENUBREAK标志相同,除了下拉菜单,子菜单,菜单和快捷菜单,其中新列是从旧列相隔一条垂直线。 MF_MENUBREAKThe项目放在一个新行(菜单栏),或在一个新的列(下拉菜单,子菜单和快捷菜单)没有分离列。 MF_OWNERDRAWThe项目所有者绘制。 MF_POPUPMenu项目是一个子菜单。 MF_SEPARATORThere是横向的分界线(为下拉菜单,子菜单和快捷菜单只)。 备注 注意GetMenuState功能已被取代的获取菜单项。您仍然可以使用GetMenuState,但是,如果您不需要的获取菜单项扩展的任何功能。 此外,它可以测试的MF_ENABLED,MF_STRING,标志值的项目MF_UNCHECKED,或MF_UNHILITE。但是,由于这些价值等同于零,您必须使用表达式来测试它们。 国旗表达来测试标志 MF_ENABLED! (旗&(MF_DISABLED | MF_GRAYED)) MF_STRING! (旗&(MF_BITMAP | MF_OWNERDRAW)) MF_UNCHECKED! (旗&MF_CHECKED) MF_UNHILITE! (旗&HILITE) 例如 有关示例,请参见模拟在菜单复选框。 功能信息 最低DLL版本 user32.dll 在Winuser.h中HeaderDeclared,头文件:winuser.h import libraryUser32.lib 最低操作系统Windows 95,Windows NT 3.1 参见 菜单,GetMenu,GetMenuItemCount,GetMenuItemID和获取菜单项 ==英文原文==GetMenuState Function The GetMenuState function retrieves the menu flags associated with the specified menu item. If the menu item opens a submenu, this function also returns the number of items in the submenu. Syntax UINT GetMenuState( HMENU hMenu, UINT uId, UINT uFlags ); Parameters hMenu [in] Handle to the menu that contains the menu item whose flags are to be retrieved. uId [in] Specifies the menu item for which the menu flags are to be retrieved, as determined by the uFlags parameter. uFlags [in] Specifies how the uId parameter is interpreted. This parameter can be one of the following values. MF_BYCOMMAND Indicates that the uId parameter gives the identifier of the menu item. The MF_BYCOMMAND flag is the default if neither the MF_BYCOMMAND nor MF_BYPOSITION flag is specified. MF_BYPOSITION Indicates that the uId parameter gives the zero-based relative position of the menu item. Return Value If the specified item does not exist, the return value is -1. If the menu item opens a submenu, the low-order byte of the return value contains the menu flags associated with the item, and the high-order byte contains the number of items in the submenu opened by the item. Otherwise, the return value is a mask (Bitwise OR) of the menu flags. Following are the menu flags associated with the menu item. MF_CHECKEDA check mark is placed next to the item (for drop-down menus, submenus, and shortcut menus only). MF_DISABLEDThe item is disabled. MF_GRAYEDThe item is disabled and grayed. MF_HILITEThe item is highlighted. MF_MENUBARBREAKThis is the same as the MF_MENUBREAK flag, except for drop-down menus, submenus, and shortcut menus, where the new column is separated from the old column by a vertical line. MF_MENUBREAKThe item is placed on a new line (for menu bars) or in a new column (for drop-down menus, submenus, and shortcut menus) without separating columns. MF_OWNERDRAWThe item is owner-drawn. MF_POPUPMenu item is a submenu. MF_SEPARATORThere is a horizontal dividing line (for drop-down menus, submenus, and shortcut menus only). Remarks Note The GetMenuState function has been superseded by the GetMenuItemInfo . You can still use GetMenuState, however, if you do not need any of the extended features of GetMenuItemInfo. In addition, it is possible to test an item for a flag value of MF_ENABLED, MF_STRING, MF_UNCHECKED, or MF_UNHILITE. However, since these values equate to zero you must use an expression to test for them. Flag Expression to test for the flag MF_ENABLED! (Flag&(MF_DISABLED | MF_GRAYED)) MF_STRING! (Flag&(MF_BITMAP | MF_OWNERDRAW)) MF_UNCHECKED! (Flag&MF_CHECKED) MF_UNHILITE! (Flag&HILITE) Example For an example, see Simulating Check Boxes in a Menu . Function Information Minimum DLL Versionuser32.dll HeaderDeclared in Winuser.h, include Windows.h Import libraryUser32.lib Minimum operating systemsWindows 95, Windows NT 3.1 See Also Menus , GetMenu , GetMenuItemCount , GetMenuItemID , GetMenuItemInfo ==原始网址==http://msdn.microsoft.com/en-us/library/ms647982(VS.85).aspx\n |
随便看 |
|
windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。