PDA

Click to See Complete Forum and Search --> : AppendMenu URGENT!!


Jan 4th, 2001, 01:55 PM
I've seen demos of the API AppendMenu Function, but have no idea how to set where the postion of the menuitem and its name are set.
I need to add unlimited numbers of menuItems to an index array (mnuFavourite(?)) as menuItems in the menu mnuFavourites. Can anyone help me?

ricmitch_uk
ricmitch_uk@yahoo.com
http://switchsoftware.scriptmania.com/

rippin
Jan 4th, 2001, 09:31 PM
Well, if you're using an array of menu items, there's really no need to use the API. In VB, when you want to add a new menu item at run-time, just use the code:


Sub AddToFavourites(strItemText As String)
Dim nCount As Long

nCount = mnuFavourites.Count
Load mnuFavourites(nCount)

mnuFavourites(nCount).Caption = strItemText
mnuFavourites(nCount).Visible = True
End Sub


If you were to use the API functions, the only way to get notification when a user clicks a menu item is to subclass the form for the WM_COMMAND message. If you need the menu to dynamically branch off into user-defined sub menus and such, then you will have to learn the APIs, but otherwise you should be fine with the code above.

Jan 5th, 2001, 03:24 PM
Thanx rippin!