网站首页  词典首页

请输入您要查询的函数:

 

术语 insertmenu
释义 InsertMenu
语法:
BOOL InsertMenu( HMENU hMenu,
UINT uPosition,
UINT uFlags,
PTR uIDNewItem,
LPCTSTR lpNewItem
);
InsertMenu函数
该InsertMenu函数插入一个新的菜单项到菜单,向下移动菜单的其他项目。
注意InsertMenu功能已被取代了InsertMenuItem功能。您仍然可以使用InsertMenu,但是,如果您不需要的InsertMenuItem扩展的任何功能。
参数
hMenu
[in]句柄菜单改变。
uPosition
[in]指定菜单项之前,该新菜单项将被插入,正如uFlags参数确定。
uFlags
[in]指定的标志控制的诠释uPosition参数和内容,外观和新的菜单项的行为。此参数必须是下列规定值之一组合,至少在以下备注一节中列出的值。
MF_BYCOMMAND
表明uPosition参数给出了菜单项的标识符。该MF_BYCOMMAND标志是,如果既不是MF_BYCOMMAND或MF_BYPOSITION标志指定的默认。
MF_BYPOSITION
表明uPosition参数提供零为基础的新菜单项的相对位置。如果uPosition为-1,新菜单项追加到菜单的末尾。
uIDNewItem
[in]指定任何新的菜单项的标识,或如uFlags参数有MF_POPUP标志集,一个句柄下拉菜单或子菜单下拉。
lpNewItem
[in]指定新菜单项的内容。在lpNewItem解释取决于是否uFlags参数包括MF_BITMAP,MF_OWNERDRAW,或MF_STRING标志,如下。
MF_BITMAP
包含一个位图句柄。
MF_OWNERDRAW
包含一个应用程序提供的价值,可用于保持与菜单项的附加数据。在价值结构的ItemData成员,指出由WM_MEASUREITEM和WM_DRAWITEM消息lParam参数时,发送到菜单项创建或其外观被更新。
MF_STRING
它包含一个指向一个空结束的字符串(默认值)。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
应用程序必须调用函数DrawMenuBar每当菜单更改,是否在菜单上显示的窗口。
以下列表描述了可以在uFlags参数设置的标志。
ValueDescription
MF_BITMAPUses位图的菜单项。该lpNewItem参数包含一个位图句柄。
MF_CHECKEDPlaces一个选中标记旁边的菜单项。如果应用程序提供检查标记位图(见SetMenuItemBitmaps),这个标志显示的检查标志位旁边的菜单项。
MF_DISABLEDDisables菜单项,以便它不能被选中,但不灰色它。
MF_ENABLEDEnables菜单项,以便它可以选择,并恢复其灰色状态。
MF_GRAYEDDisables菜单项和灰色,这样就能够不被选中。
MF_MENUBARBREAKFunctions作为一个菜单栏MF_MENUBREAK标志相同。对于一个下拉菜单,子菜单或快捷菜单,新列下拉分开旧列由垂直线。
MF_MENUBREAKPlaces的项目在一个新行(菜单栏),或在一个新的列(下拉菜单,子菜单或快捷菜单中)没有分离列。
MF_OWNERDRAWSpecifies该项目是一个所有者描述的项目。之前菜单首次显示,窗口,拥有菜单收到WM_MEASUREITEM消息检索的宽度和高度的菜单项。在WM_DRAWITEM消息,然后发送到主人的窗口的窗口过程时,该菜单项的外观必须更新。
MF_POPUPSpecifies该菜单项打开一个下拉菜单或子菜单下拉。在uIDNewItem参数指定一个句柄下拉菜单或子菜单下拉。这个标志是用来添加一个菜单名字命名的菜单栏或菜单项,打开子菜单的下拉菜单,子菜单或快捷菜单。
MF_SEPARATORDrawsLevel的分界线。这个标志只用于在一个下拉菜单,子菜单或快捷菜单。该生产线不能变灰,残疾,或强调。在lpNewItem和uIDNewItem参数将被忽略。
MF_STRINGSpecifies该菜单项是一个文本字符串;的lpNewItem参数是一个字符串指针。
MF_UNCHECKEDDoes不把复选标记旁边的菜单项(默认)。如果应用程序供应检查标记位图(见SetMenuItemBitmaps函数),这个标志显示的清晰图旁边的菜单项。
旗帜以下组不能一起使用:
MF_BYCOMMAND和MF_BYPOSITION
MF_DISABLED,MF_ENABLED和MF_GRAYED
MF_BITMAP,MF_STRING,MF_OWNERDRAW和MF_SEPARATOR
MF_MENUBARBREAK和MF_MENUBREAK
MF_CHECKED和MF_UNCHECKED
在Windows 95/98/Me:InsertMenuW是支持微软层对于Unicode。要使用此,您必须将某些文件到您的应用,概述了对Unicode的Microsoft层在Windows 95/98/Me系统。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
UnicodeImplemented为ANSI和Unicode版本。
参见
菜单,AppendMenu,DeleteMenu,DrawMenuBar,InsertMenuItem,ModifyMenu,RemoveMenu,SetMenuItemBitmaps,WM_DRAWITEM,WM_MEASUREITEM
==英文原文==InsertMenu Function
The InsertMenu function inserts a new menu item into a menu, moving other items down the menu.
Note The InsertMenu function has been superseded by the InsertMenuItem function. You can still use InsertMenu, however, if you do not need any of the extended features of InsertMenuItem.
Syntax
BOOL InsertMenu( HMENU hMenu,
UINT uPosition,
UINT uFlags,
PTR uIDNewItem,
LPCTSTR lpNewItem
);
Parameters
hMenu
[in] Handle to the menu to be changed.
uPosition
[in] Specifies the menu item before which the new menu item is to be inserted, as determined by the uFlags parameter.
uFlags
[in] Specifies flags that control the interpretation of the uPosition parameter and the content, appearance, and behavior of the new menu item. This parameter must be a combination of one of the following required values and at least one of the values listed in the following Remarks section.
MF_BYCOMMAND
Indicates that the uPosition 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 uPosition parameter gives the zero-based relative position of the new menu item. If uPosition is -1, the new menu item is appended to the end of the menu.
uIDNewItem
[in] Specifies either the identifier of the new menu item or, if the uFlags parameter has the MF_POPUP flag set, a handle to the drop-down menu or submenu.
lpNewItem
[in] Specifies the content of the new menu item. The interpretation of lpNewItem depends on whether the uFlags parameter includes the MF_BITMAP, MF_OWNERDRAW, or MF_STRING flag, as follows.
MF_BITMAP
Contains a bitmap handle.
MF_OWNERDRAW
Contains an application-supplied value that can be used to maintain additional data related to the menu item. The value is in the itemData member of the structure pointed to by the lParam parameter of the WM_MEASUREITEM or WM_DRAWITEM message sent when the menu item is created or its appearance is updated.
MF_STRING
Contains a pointer to a null-terminated string (the default).
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
Remarks
The application must call the DrawMenuBar function whenever a menu changes, whether or not the menu is in a displayed window.
The following list describes the flags that can be set in the uFlags parameter.
ValueDescription
MF_BITMAPUses a bitmap as the menu item. The lpNewItem parameter contains a handle to the bitmap.
MF_CHECKEDPlaces a check mark next to the menu item. If the application provides check-mark bitmaps (see SetMenuItemBitmaps ), this flag displays the check-mark bitmap next to the menu item.
MF_DISABLEDDisables the menu item so that it cannot be selected, but does not gray it.
MF_ENABLEDEnables the menu item so that it can be selected and restores it from its grayed state.
MF_GRAYEDDisables the menu item and grays it so it cannot be selected.
MF_MENUBARBREAKFunctions the same as the MF_MENUBREAK flag for a menu bar. For a drop-down menu, submenu, or shortcut menu, the new column is separated from the old column by a vertical line.
MF_MENUBREAKPlaces the item on a new line (for menu bars) or in a new column (for a drop-down menu, submenu, or shortcut menu) without separating columns.
MF_OWNERDRAWSpecifies that the item is an owner-drawn item. Before the menu is displayed for the first time, the window that owns the menu receives a WM_MEASUREITEM message to retrieve the width and height of the menu item. The WM_DRAWITEM message is then sent to the window procedure of the owner window whenever the appearance of the menu item must be updated.
MF_POPUPSpecifies that the menu item opens a drop-down menu or submenu. The uIDNewItem parameter specifies a handle to the drop-down menu or submenu. This flag is used to add a menu name to a menu bar or a menu item that opens a submenu to a drop-down menu, submenu, or shortcut menu.
MF_SEPARATORDraws a horizontal dividing line. This flag is used only in a drop-down menu, submenu, or shortcut menu. The line cannot be grayed, disabled, or highlighted. The lpNewItem and uIDNewItem parameters are ignored.
MF_STRINGSpecifies that the menu item is a text string; the lpNewItem parameter is a pointer to the string.
MF_UNCHECKEDDoes not place a check mark next to the menu item (default). If the application supplies check-mark bitmaps (see the SetMenuItemBitmaps function), this flag displays the clear bitmap next to the menu item.
The following groups of flags cannot be used together:
MF_BYCOMMAND and MF_BYPOSITION
MF_DISABLED, MF_ENABLED, and MF_GRAYED
MF_BITMAP, MF_STRING, MF_OWNERDRAW, and MF_SEPARATOR
MF_MENUBARBREAK and MF_MENUBREAK
MF_CHECKED and MF_UNCHECKED
Windows 95/98/Me: InsertMenuW is supported by the Microsoft Layer for Unicode. To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems .
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 ANSI and Unicode versions.
See Also
Menus , AppendMenu , DeleteMenu , DrawMenuBar , InsertMenuItem , ModifyMenu , RemoveMenu , SetMenuItemBitmaps , WM_DRAWITEM , WM_MEASUREITEM
==原始网址==http://msdn.microsoft.com/en-us/library/ms647987(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 13:20:26