menu API

来源:互联网 发布:查看windows系统版本 编辑:程序博客网 时间:2024/06/07 01:08


获得指定菜单的flag,如果这个菜单打开了子菜单,这个函数也将返回子菜单的数量。

UINT WINAPI GetMenuState(  _In_ HMENU hMenu,  //将打开的菜单句柄  _In_ UINT  uId,   //菜单号  _In_ UINT  uFlags  //参数的理解方式);

uflags:Indicates how the uId parameter is interpreted. This parameter can be one of the following values.

ValueMeaning
MF_BYCOMMAND
0x00000000L

Indicates that the uId parameter gives the identifier of the menu item. TheMF_BYCOMMAND flag is the default if neither the MF_BYCOMMAND norMF_BYPOSITION flag is specified.

MF_BYPOSITION
0x00000400L

Indicates that the uId parameter gives the zero-based relative position of the menu item.



返回值:若specified item不存在,返回-1

存在的话,返回mask值,

Return code/value Description

MF_CHECKED
0x00000008L

A check mark is placed next to the item (for drop-down menus, submenus, and shortcut menus only).

MF_DISABLED
0x00000002L

The item is disabled.

MF_GRAYED
0x00000001L

The item is disabled and grayed.

MF_HILITE
0x00000080L

The item is highlighted.

MF_MENUBARBREAK
0x00000020L

This 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_MENUBREAK
0x00000040L

The 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_OWNERDRAW
0x00000100L

The item is owner-drawn.

MF_POPUP
0x00000010L

Menu item is a submenu.

MF_SEPARATOR
0x00000800L

There is a horizontal dividing line (for drop-down menus, submenus, and shortcut menus only).



CheckMenuItem是一个API函数,功能是复选或撤消复选指定的菜单条目。

DWORD WINAPI CheckMenuItem(  _In_ HMENU hmenu,  //含有其菜单项的标志将被提取得的菜单的句柄。  _In_ UINT  uIDCheckItem, //来确定输的选项框被选择或者设置  _In_ UINT  uCheck    //可选择下列选项mask);
Value Meaning
MF_BYCOMMAND
0x00000000L

Indicates that the uIDCheckItem parameter gives the identifier of the menu item. TheMF_BYCOMMAND flag is the default, if neither the MF_BYCOMMAND norMF_BYPOSITION flag is specified.

MF_BYPOSITION
0x00000400L

Indicates that the uIDCheckItem parameter gives the zero-based relative position of the menu item.

MF_CHECKED
0x00000008L

Sets the check-mark attribute to the selected state.

MF_UNCHECKED
0x00000000L

Sets the check-mark attribute to the clear state.

返回值:

The return value specifies the previous state of the menu item (either MF_CHECKED or MF_UNCHECKED). If the menu item does not exist, the return value is –1.





0 0
原创粉丝点击