Link to home
Start Free TrialLog in
Avatar of pin_plunder
pin_plunder

asked on

Add a item to a menu at runtime

the title says it all.

i'll use it for displaying the recent opened/saved files.

any ideas?

thanks
Avatar of Vbmaster
Vbmaster

How about adding one item and use the Load statement to load more items during run-time, this is the most used method for these kind of problems.

Create a menu item with index 0 and use Load mnuname(1).. Load mnuname(2) etc to load more items.
another option is to use a set number of recent files, and change the caption and visible property at run-time to control the names and how many are shown.
There is an Win API function that is AppendMenu that lets you insert a menu item on a menu. Thought this function needs that you supply it with the menu Handle. To get the menu handle you can use the GetMenu Win API function. This function will return you the handle. My advise is for you to get an Win API reference and see the help about these functions.
Avatar of pin_plunder

ASKER

vbMasteer, i like your comment, post it as an answer and i'll give you the points.
pin_plunder, you can select vbmasters comment as the selected answer without having him post again.  There is a clickable area for this on the "Comment" line...


Cheers!
ASKER CERTIFIED SOLUTION
Avatar of Vbmaster
Vbmaster

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks vbmaster your help was useful.