Create Popup Menus without a Form by Brian Yule

Applies To

OS:
VB:
NT, 9x, 2000
5, 6

Author: Brian Yule (byule at PembrokeTechnology.com)

Download... the project. (12 kb)

In Visual Basic 2-6, we've been stuck with the same Menu Editor. If you want to popup a menu in your app, you have to define it first in the Menu Editor. But what if want to create a Popup menu on the fly? You are out of luck.

Brian Yule has created a well-modularized all API method for creating Popup menus at any time in your app. To bring up a menu you code is this simple:

    Set popupMenu = New BX_MNU.popupMenu

    Call popupMenu.AddStringMenuItem("One", 0)
    Call popupMenu.AddStringMenuItem("Two", 1)
    Call popupMenu.AddStringMenuItem("Three", 2)
    Call popupMenu.AddSeparatorMenuItem
    Call popupMenu.AddStringMenuItem("Four", 3)
    
    Call popupMenu.ShowPopupMenu

Download... the project. (12 kb)

To get in touch with the author of this example, email Brian Yule at byule at PembrokeTechnology.com