With the appearance of every new version of MS Office, new GUI 'features' are added to them. With Office 97, buttons were added to the menus. In PowerBuilder you don't have an option of putting a button to the left of a menu-item.
To make it possible to add buttons to a PowerBuilder menu, I wrote a C++-dll to establish it. The dll takes over the painting of the menu. Via a non-visual userobject the bitmaps or StockItems that must be shown to the left of the menuitems are added to an ImageList (created within the dll). Furthermore, messages sent to the application Window are intercepted by the dll and handled if menu-painting is concerned. All other messages are sent through to the application window.
To use the dll put it in your application directory or system-direcory. The nonvisual userobject (n_coolmenu) contains a couple of functions you can call.
of_SetRequestor( Ref Window aw_Requestor ) Returns Integer. Registers the window requesting the 'service'.
of_SetMenu( String as_Menu ) Returns Integer. Must be called to determine the bitmaps that must be shown to the left of the menuitems. Some points:
of_SetButtonOn( Boolean ab_Switch ) Returns Integer. With this function you can give the user the opportunity to switch between menus with or without bitmaps.
of_ToolbarVisibleOnly( Boolean ab_Switch ) Returns Integer. By using this function you can tell the of_SetMenu function to just show bitmaps that are visible on the toolbars. So you must call this one before calling of_SetMenu.
The dll works with StockItems, .bmp and .ico files. The stockitems are all included within the dll (PowerBuilder versions 6, 7 and 8).
You can code the following in the Open-event of your MDI- or Main Window.
inv_CoolMenu.of_ToolbarVisibleOnly( False )
inv_CoolMenu.of_SetMenu( 'm_coolmenu' )
The usage of this dll is at your own risk. I developed it in my spare time and aren't asking any money for it. So it's not a commercial product. As far as I know (but I couldn't test it on every Windows-version that exists) it works very well. If you find any problems in using this dll you can e-mail me. I will try to fix problems as soon as I can. But remember, it was meant for one of my own applications, and I decided to put it on my website so you can use it if you like to. But every responsibility for using it is for yourselfs (I know this all sounds a bit paranoid, but one never knows).
You can download the dll and a sample application (PB7) here.