网站首页  词典首页

请输入您要查询的函数:

 

术语 appendmenu
释义 AppendMenu
语法:
BOOL AppendMenu( HMENU hMenu,
UINT uFlags,
UINT_PTR uIDNewItem,
LPCTSTR lpNewItem
);
AppendMenu函数
AppendMenu函数的一个新项目追加到指定的菜单栏,下拉菜单,子菜单或快捷菜单结束。您可以使用此函数来指定内容,外观和菜单项的行为。
参数
hMenu
[in]句柄菜单栏,下拉菜单,子菜单或快捷菜单进行更改。
uFlags
[in]指定标志来控制的外观和新的菜单项的行为。此参数可以是下列备注节中列出的值的组合。
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每当菜单更改,是否在菜单上显示的窗口。
为了键盘加速器与位图或自行绘制的菜单项,菜单的拥有者必须处理WM_MENUCHAR消息。有关更多信息,请所有者描述的菜单和WM_MENUCHAR消息。
以下标志可以设置在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_BITMAP,MF_STRING,并MF_OWNERDRAW
MF_CHECKED和MF_UNCHECKED
MF_DISABLED,MF_ENABLED和MF_GRAYED
MF_MENUBARBREAK和MF_MENUBREAK
在Windows 95/98/Me:AppendMenuW是支持微软层对于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版本。
参见
菜单,CreateMenu,DeleteMenu,DestroyMenu,DrawMenuBar,InsertMenu,InsertMenuItem,ModifyMenu,RemoveMenu,SetMenuItemBitmaps
==英文原文==AppendMenu Function
The AppendMenu function appends a new item to the end of the specified menu bar, drop-down menu, submenu, or shortcut menu. You can use this function to specify the content, appearance, and behavior of the menu item.
Syntax
BOOL AppendMenu( HMENU hMenu,
UINT uFlags,
UINT_PTR uIDNewItem,
LPCTSTR lpNewItem
);
Parameters
hMenu
[in] Handle to the menu bar, drop-down menu, submenu, or shortcut menu to be changed.
uFlags
[in] Specifies flags to control the appearance and behavior of the new menu item. This parameter can be a combination of the values listed in the following Remarks section.
uIDNewItem
[in] Specifies either the identifier of the new menu item or, if the uFlags parameter is set to MF_POPUP, 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 shown in the following table.
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 is created or its appearance is updated.
MF_STRING
Contains a pointer to a null-terminated string.
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.
To get keyboard accelerators to work with bitmap or owner-drawn menu items, the owner of the menu must process the WM_MENUCHAR message. For more information, see Owner-Drawn Menus and the WM_MENUCHAR Message .
The following flags 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 the flag 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 that 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 a menu bar) 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 item (default). If the application supplies check-mark bitmaps (see SetMenuItemBitmaps), this flag displays the clear bitmap next to the menu item.
The following groups of flags cannot be used together:
MF_BITMAP, MF_STRING, and MF_OWNERDRAW
MF_CHECKED and MF_UNCHECKED
MF_DISABLED, MF_ENABLED, and MF_GRAYED
MF_MENUBARBREAK and MF_MENUBREAK
Windows 95/98/Me: AppendMenuW 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 .
Example
For an example, see Adding Lines and Graphs to 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
UnicodeImplemented as ANSI and Unicode versions.
See Also
Menus , CreateMenu , DeleteMenu , DestroyMenu , DrawMenuBar , InsertMenu , InsertMenuItem , ModifyMenu , RemoveMenu , SetMenuItemBitmaps
==原始网址==http://msdn.microsoft.com/en-us/library/ms647616(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:25:24