Solved

AppendMenu and RemoveMenu API?

Posted on 1998-08-28
1
914 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

895 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now