Solved

AppendMenu and RemoveMenu API?

Posted on 1998-08-28
1
910 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
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

771 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

10 Experts available now in Live!

Get 1:1 Help Now