Solved

AppendMenu and RemoveMenu API?

Posted on 1998-08-28
1
919 Views
Last Modified: 2012-06-27
The following functions can be used to add and remove items to/from the control menu. Can anyone explain to me what are the values and meanings for the:

1. wFlags (in both functions)
2. wIDNewItem

Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long

Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As String) As Long

RetVal = RemoveMenu (hMenu, nPosition, wFlags)
RetVal = AppendMenu (hMenu, wFlags, wIDNewItem, lpNewItem)

Thanks.
0
Comment
Question by:gelco
1 Comment
 
LVL 8

Accepted Solution

by:
MikeP090797 earned 100 total points
ID: 1431738
wIDNewItem is the item id that will be passed in WM_COMMAND message when you menu is clicked

wFlags set's the type of the menu:


MF_BITMAP      Uses a bitmap as the item. The lpNewItem parameter contains the handle to the bitmap.
MF_CHECKED      Places a check mark next to the item. If the application provides check mark bitmaps (see SetMenuItemBitmaps), this flag displays the check mark bitmap next to the menu item.
MF_DISABLED      Disables the menu item so that it cannot be selected, but the flag does not gray it.
MF_ENABLED      Enables the menu item so that it can be selected and restores it from its grayed state.
MF_GRAYED      Disables the menu item and grays it so it cannot be selected.
MF_MENUBARBREAK      Functions the same as the MF_MENUBREAK flag except for pop-up menus, where the new column is separated from the old column by a vertical line.
MF_MENUBREAK      Places the item on a new line (for menu bars) or in a new column (for pop-up menus) without separating columns.
MF_OWNERDRAW      Specifies 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_POPUP      Specifies that the menu item is a pop-up item; that is, selecting it activates a pop-up menu. The uIDNewItem parameter specifies the handle to the pop-up menu. This flag is used to add a pop-up item to a menu bar or to a pop-up menu.
MF_SEPARATOR      Draws a horizontal dividing line. This flag is only used in a pop-up menu. The line cannot be grayed, disabled, or highlighted. The lpNewItem and uIDNewItem parameters are ignored.
MF_STRING      Specifies that the menu item is a text string; the lpNewItem parameter points to the string.
MF_UNCHECKED      Does not place a check mark next to the item (default). If the application supplies check mark bitmaps (see SetMenuItemBitmaps), this flag displays the unchecked bitmap next to the menu
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Updates not working for MS Windows 7 12 181
Error when passing an argument to a vb6 that contains  '/' 7 39
Spell Check in VB6 13 126
VBA: loop recent folder and copy txt file. 8 33
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question