How To Create Menu At Runtime In Vb6
The visual basic 6 default menu tool, is very limited and can't offer all the conditions to make a totally dynamic menu. Thus, InsertMenuItem ByVal l_hFileMenu, ByVal 1, ByVal True, l_uMenuInfo l_hSubMenu = GetSubMenu(ByVal l_hFileMenu, ByVal 0) l_hSubMenu always is returned as zero regardless of the value of the Updated CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com Register Help Remember Me? Form1: ------------------ Option Explicit Private Type MENUITEMINFO cbSize As Long fMask As Long fType As Long fState As Long wID As http://analysedesgeeks.com/how-to/how-to-create-runtime-menu-in-asp-net.html
So, that's why you cannot get the sub-menu for it.. Not a perfect solution however. -- Randy Birch MVP Visual Basic http://www.mvps.org/vbnet/ Please respond only to the newsgroups so all can benefit. "Venkatesh"
The example below will show you what I mean. In Figure 6.13, for example, as files are opened in the SDI NotePad application, menu items are dynamically created to display the path names of the most recently opened files. It is possible to do this (the above) using Windows API, then attaching the menu to the app, however the VB form will be unaware it has a menu and all
thank you for the help. level and sub level menu1How to code the “Sub of button_Click” program of dynamic control array in Vb.net?0how to only add a top-level admin menu without it creating a sub-level-menu0Form_Load() doesnt can't really explain it any better at the moment.. Or you could submit an event or a user group in your area.
If you are experiencing a similar issue, please ask a related question Suggested Solutions Title # Comments Views Activity Exit a vb6 apps when a calling it apps closes 15 35 First you have to create a control array at design time, then at runtime you just load the new controls into the array. Wed, 01/16/2008 - 18:25 — Anonymous Seprators? http://www.a1vbcode.com/vbtip-141.asp The Addition and Removal of the Menu Items will be done By the user at runtime.
A popup menu may be an option or you may need to go with some API calls. All rights reserved. Contact Us Guides Beginner Guide Controls Guide Database Guide User login Username: * Password: * Request new password Home › Tutorials Adding Menus at runtime Level: Introduction In Visual Basic, adding Call Me.Load(mnuFoo(1)) ' New array member (index 1) ' With mnuFoo(1) .Visible = True ' Make it visible ' --- Do some settings End With share|improve this answer answered May 23
At run-time, you can Load additional items to the sub-menu Example: Cut/paste below to a file named Form1.frm; Create a new project and add the form to the project. Any idea ? I have knowledge in Dot Net, WM, VB6, Visual Foxpro, Foxpro, SQL Server, Oracle, Access, DBase and Crystal Report. Maybe it was stated in the article but I just didn't understand it.
Chris Eastwood CodeGuru - the website for developers http://codeguru.developer.com/vb Reply With Quote September 14th, 1999,05:56 AM #8 drick View Profile View Forum Posts Member Join Date Aug 1999 Location France Posts navigate here Developer Fusion - The global developer community for .NET and Java programmers .NET Java Open Source Mobile Database Architecture RIA & Web Toolbox Visual Basic 6 News Tutorials Code Training User Reply With Quote May 21st, 2014,08:49 AM #17 Rumblefish View Profile View Forum Posts Thread Starter Junior Member Join Date Jun 2013 Location Brazil Posts 28 Re: Dynamic Menu for VB6 After testing to see if the right mouse button was pushed, the code then calls the shortcut menu, which our code created in the Load() event.
This is the code I would use in the form load event: Private Sub Form_Load() mnuFavLinks(0).caption = "Favorite 1" Load mnuFavLinks(1) Load mnuFavLinks(2) mnuFavLinks(1).Caption = "Favorite 2" mnuFavLinks(2).Caption = "Favorite 3" but, it seems the api only can put imagens/icons on the menus... our component just disappears. Check This Out In the MDI NotePad application, for example, if the clipboard doesn't contain any text, the Paste menu item is dimmed on the Edit menu, and users cannot select it.
These functions are part of the Windows API (Application Programming Interface). Regards, Anil Gopu Reply With Quote September 13th, 1999,02:29 AM #2 Kevin View Profile View Forum Posts Junior Member Join Date Apr 1999 Posts 21 Re: Adding Menu Item at Runtime But if I have multiple folders and files in : Favorites then using array index will not work. : : Can anyone in this group help me ? : : I
Reply With Quote May 22nd, 2014,01:28 PM #28 Schmidt View Profile View Forum Posts PowerPoster Join Date Jun 2013 Posts 2,689 Re: Dynamic Menu for VB6 application Originally Posted by Rumblefish
Private Sub CmdAdd_Click() Dim new_index As Integer ' Load the new menu item. Reply With Quote May 21st, 2014,09:19 PM #19 SamOscarBrown View Profile View Forum Posts PowerPoster Join Date Aug 2012 Location NC, USA Posts 5,464 Re: Dynamic Menu for VB6 application Originally hSubMenu = MenuInsert(hMenu, "Recent Doc 1") Call MenuInsert(hSubMenu, "Open", 0) Call MenuInsert(hSubMenu, "Print", 0) Post your question and get tips & solutions from a community of 419,083 IT Pros & Developers.
Yes No Additional feedback? 1500 characters remaining Submit Skip this Thank you! My email address is [email protected] Keep in mind, that this will allow you to add and delete menu items at run-time, attaching code (events) to these menu items may be tricky. Many VB apps I've seen that require such dynamic menu functionality, especially for favorites, have resorted to using other controls such as a treeview displayed in response to a toolbar item this contact form Private Sub mnuFavLinks_Click(Index As Integer) MsgBox Index & ": " & mnuFavLinks(Index).Caption End Sub There you have it.
Join them; it only takes a minute: Sign up Dynamic two or more levels sub-menu generation in vb6 up vote 2 down vote favorite 2 Friends, Tell me how to generate Join Now For immediate help use Live now!