Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

AppendMenu and RemoveMenu API?

Posted on 1998-08-28
1
Medium Priority
?
944 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 200 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

927 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