Archive for May 19th, 2008

Create context menus in code in Visual Basic 6

Example of SimpleMenu in action

If, like me, you’re job is maintaining a large Visual Basic 6 application you’ll know the pain of creating context menus. You’d like them on the form you’re working with, but if its an MDI child form you’re forced to place them on a different form if you want to see your MDI parent forms menus while your child form has the focus.

This isn’t fun, because you know how two places for code that should all be together. Not to mention that most of the time you’re creating menus at design time, not at run-time.

In the past I’ve come up with ways of at least keeping the code in the form showing the menu by having the menus simply set a return value which the calling form can then just read and do whatever with.

Recently I read an example of run-time menus (I forget where) that used the idea of control arrays to allow for creation of menus at runtime. I liked this idea and ran with it.

Here, I offer up a couple of classes for simple creation and use of context menus at run-time in a VB6 application. It uses no weird system DLL calls. I hope it saves someone weeping over menus. It did me.

SimpleMenuv1.zip

Start Slide Show with PicLens Lite PicLens

Chanel watches again in the swiss replica watches forefront of the times, the concept of replica watches innovation and high-tech equipment and the Swiss tradition of combining technology to create a unique artistic quality. In the omega replica most advanced production plant, a traditional clock technology combined with replica hublot sophisticated technology and equipment, ensure each link smoothly, from production to installation of advanced watchcase watchband movement of production by the Swiss specialized manufacturers, and Chanel will each creative transformation into full of new products.