Win32 API Menu Demo
Written by Chris Molloy on 30 Aug 2002
Categories / keywords: Win32 API, Lotusscript, Menus
(click on a term to search for related articles at this site)
Background
R5 introduced nice cascading action bar buttons. But did you know you can have cascading menu items everywhere courtesy of the Win32 API?
The application
The attached database, in zip format, is a simple demonstration of this functionality. A combination of Win32 API calls are used to provide cascading menus in any Notes client application. See the screenshot below for more of an idea of what this application does:

Note that the example database uses action bar buttons stored in a "placeholder" page to demonstrate the menu items, but they could be triggered by all kinds of click events in the Notes client. The code has also been tinkered with in the R4.x client, so cascading action bars in R4 here we come!
Functions used
All this code makes use of a number of Win32 functions, and these are...
Then, for building the menu itself...
- GetCursorPos
- CreatePopupMenu
- AppendMenu
- TrackPopupMenu
Clean up...
- DestroyMenu
- GetMessage
Structuring your menus
The code is the simple bit; by far the most complex issue is structuring your cascading menus. Which option should be greyed-out and when? How many levels could / should a menu go to? All such questions need to be addressed. The database code contains some sample guidelines with regards menu construction.
The example database is coded so that via a messagebox, it prompts the user with the name of the menu item selected — it does nothing more than that. Effectively this code provide you with a model for generating menus and performing an — albeit crude — system of event handling.
The rest is up to you!
Further reading:
Attachment(s): win32menu.zip (54 KB)
» Win32 API Menu Demo (Chris Molloy 30 Aug 2002)
RE: Win32 API Menu Demo (John Burgman 11 Jun 2003)
RE: Win32 API Menu Demo (Ben Poole 11 Jun 2003)
RE: Win32 API Menu Demo (John Burgman 12 Jun 2003)
RE: Win32 API Menu Demo (punk 16 Jun 2003)
RE: Win32 API Menu Demo (John Burgman 26 Jun 2003)
RE: Win32 API Menu Demo (David 14 Sep 2004)
