Coolmenu

 

horizontal rule

Author Aart Onkenhout
Date 12-10-2003

 

Version 2.5

A new version of the coolmenu dll. This version has some improvements / changes over version 2.0:

 

bullet

Now works with multithreaded applications;

bullet

Menubar can have an Office Xp or Office 2003 look too;

bullet

Menus can have a flat border and shadows;

bullet

Stockitems are no longer integrated within the dll but read from the PowerBuilder dll's;

bullet

Smaller size;

bullet

Source code restructured (no longer all code within one single file).

bullet

Set a resource file to be used for loading images (by resource id);

bullet

n_coolmenu no longer autoinstantiated.

 

 

On the nonvisual n_coolmenu there are some new functions:

bullet

of_Initialize: instead of calling of_SetRequestor for a specific window you can now call this function within, for example, the application object (before any window is opened). The coolmenu dll sets a hook for the current thread and notices when a new window is created.

bullet

of_Uninitialize: removes thread specific hook and frees memory.

bullet

of_SetCoolMenubar: enables or disables the Office look for the menubar.

bullet

of_SetFlatMenu: enables or disables the drawing of a flat border for the menus.

bullet

of_SetShadow: enables or disables the drawing of a shadow.

bullet

of_SetMenubarColor: sets the color for the menubar (Office Xp and Office 2003 style only).

bullet

of_SetResourceFile: sets the resource file to load images from. To use this the dll needs to know the resource id for the resource to load. To pass this to the dll you have to use the Tag property of a menuitem like: id=101. For the background color of an image it was possible to give a systemcolor index, x and y pixel or just a color. These have to be of the form bc=. If you sent x and y pixel coordinates to the dll, separate them by a - instead of a ,.

 

Usage

Using the dll is very simple. Add an instance variable to your application object and put the following code in the Open-event:

 

// This code must be called before any window is opened!

inv_Coolmenu = Create n_coolmenu
inv_Coolmenu.of_Initialize()
inv_Coolmenu.of_SetMenu( "m_coolbar" )

 

In the close-event you must call:

 

inv_Coolmenu.of_Uninitialize()

Destroy inv_Coolmenu
 

Actually that's all there is. There are more functions that can be called, but these lines of code are enough to make it work.

 

Coolmenu 2.5 Build 175, Released: 10.07.2007

 

bullet

Crash solved when using ChangeMenu;

bullet

Bug solved when hiding and showing menuitems on the menubar;

bullet

Colors more Office 2003 like.

 

Coolmenu 2.5 Build 166, Released: 06.05.2007

 

bullet

Bug solved when changing WIndow Xp theme with React On Theme Change turned on (when working with PB10.5 or higher).

 

Coolmenu 2.5 Build 164, Released: 12.04.2007

 

bullet

Now really works with PB10.5. You have to set the menu style to TraditionalMenu!

bullet

Improvements to drawing disabled images.

 

Coolmenu 2.5 Build 130, Released: 19.09.2005

 

bullet

Processing of calling of_Set2K3Gradient wasn't correct (since build 126);

bullet

Problem when using resourcefile in n_coolmenu.

bullet

Function added to set color and text characteristics (bold, italic, underlined) for individual menuitems. This can be done by using the tag property or by calling of_SetMenuItemProps. When using the tag property use it=1 to make the text italic, ut=1 to make it underlined, bt=1 to make it appear bold and tc=color to set a specific color.

 

Coolmenu 2.5 Build 127, Released: 27.08.2005

 

bullet

Problem fixed with redrawing the menubar when hiding/showing menuitems.

bullet

Problem fixed when changing between menu styles (sometimes the menubar didn't get Office Xp or 2003 style back).

 

Coolmenu 2.5 Build 126, Released: 22.08.2005

 

bullet

Coolmenu now reacts on theme and color changes.

bullet

Change to imagelist to show Xp style icons with alpha channel in the correct way.

 

Coolmenu 2.5 Build 119, Released: 02.06.2005

 

bullet

GDI objects leak removed;

bullet

Some unused functions removed.

 

 

Coolmenu 2.5 Build 115, Released: 04.04.2005

 

bullet

Problems fixed with redrawing of the menubar (Office Xp and 2003 style).

bullet

Small bug fixed within n_coolmenu control (thanks to Oleg Vysotsky).

 

Download version 2.5

Download source code version 2.5 build 175 (Visual Studio 6.0 workspace)

Download coolmenu25.zip (2.5, PB10)

Download coolmenu25_pb9.zip (2.5, PB9)

Download coolmenu.dll version 2.5_build 175 (NEW)

Download n_coolmenu.sru for PB10.5 and PB11.0

 

 

If you have any questions, suggestions or whatsoever, feel free to send me an e-mail.

 

Version 2.0

As I'm not getting lots of bugs anymore I don't call it a beta from now on. I like to say a big thank to those people who were willing to test this new version and sent me one or more bugs. To be more specific:

 

Lilian Pigallio

George Liuyuhui

Luan Tran

Lee Wei

Thierry Decamps

Paul (don't know your lastname)

Antonio Moreno Verdugo

Mark Pare

 

Within the source code, and especially within the file coolmenu.cpp, comment is added about the working of the dll. The fundamentals of the code are based on an article by Paul Dilascia in the Microsoft Journal (now called MSDN Magazine) and can be found at

Give Your Applications the Hot New Interface Look with Cool Menu Buttons. It might be interesting to read this for a better understanding. Additions to the code were based on several articles on www.codeproject.com (in the Menu section).

 

Things to do:

 

bullet

Give the menubar (File Edit Help) Office Xp (2003) look too when using Office Xp (2003) style.

bullet

Test on every Windows version (now tested on Windows 98, NT, 2000 and Xp).

 

 

Feedback

Please feel free to send feedback (questions, bugs, code improvements, suggestions for additions) to pbsite@gmail.com. I will try to respond to it as quickly as possible.

 

What changed in the latest version?

On this page I will keep you informed on new versions and the changes to these version.

 

Coolmenu 2.0 Build 165, Released: 08.02.2004

 

bullet

Problem fixed where first item in menu was a separator.

bullet

Memory leak when opening a menu fixed (thanks to Stefan Olsson).

 

Coolmenu 2.0 Build 160, Released: 02.05.2004

 

bullet

Functions added for Unicode (to work with PB10). For function calls that require a string as an argument, a Unicode version of the function is added (e.g. AddImageW).

bullet

Problem fixed when menutext was changed on selecting a menuitem when the menu is already opened (bug sent by Shekar C. Reddy and Steve Goris).

 

Coolmenu 2.0 Build 150, Released: 12.29.2003

 

bullet

Coolmenu now works with images with more than 16 colors.

 

 

Coolmenu 2.0 BETA Build 149, Released: 12.17.2003

 

bullet

Problem fixed when closequery event returned 1 on the frame window.

bullet

Problem fixed with setting the focus to the correct control.

bullet

Function added to set gradient colors for Office 2003 style.

 

 

Coolmenu 2.0 BETA Build 147, Released: 12.15.2003

 

bullet

Crash under Windows NT fixed (project setting).

bullet

Fixed font resizing problem when changing Windows settings.

bullet

Fixed problem with activating and deactivating windows within an application using coolmenu.

bullet

Office 2003 style added. Change styles by calling of_Set2KStyle, of_SetXpStyle, of_Set2K3Style and of_SetNormalStyle (= no buttons).

bullet

Support added for gif an jpg. Now not only stock images, bmp and ico files can be used but jpg and gif as well.

 

 

Coolmenu 2.0 BETA Build 130, Released: 11.05.2003

 

bullet

Bug fixed in buffer allocation (caused a crash in some circumstances).

bullet

Changed arguments for call to AddImage. Now you can specify which pixel to use for determing the transparent backgroundcolor (see usage also).

bullet

Stockitems missing from PB9 were added. Also corrected some.

 

 

Coolmenu 2.0 BETA Build 97, Released: 10.13.2003

 

bullet

Office Xp style is added. Switch between Office 97 style and Office Xp style by calling of_SetXpStyle( Boolean ).

bullet

Couple of functions are added to set the menu colors when using Office Xp style (see the sample application).

bullet

A big memory-leak is removed.

bullet

Previous version just worked with menu's on the frame window. This one works on every window within the application.

bullet

The way the color is determined to make an image appear transparent has changed.

 

Usage

 

See Bitmaps in menus.

 

For the backgroundcolor to be used by the dll to make an image appear transparent the dll uses the left uppermost pixel. If this pixel is part of the actual bitmap (e.g. Copy!) the wrong color is replaced. To work around this you can use the tag property of a menuitem. There are 5 options:

  1. Leave it empty: the dll determines what color to use based on left uppermost pixel;

  2. Set it to -1: don't use any backgroundcolor (leave the image as it is);

  3. Set it to an index to be used to get a system defined color (like buttonface). See instance variables declared on n_coolmenu;

  4. Set it to an RGB value you want to use;

  5. Define an x and y pixel position to be used (instead of the left uppermost pixel (0,0).

 

Sample Screens

 

 

 

Download

 

You need to use the n_coolmenu object from the new PB sample as calls have been added for unicode or you can just download the exportfile from n_coolmenu.

 

Version 2.0

Download source code build 165 (Visual Studio 6.0 workspace)

Download coolmenu.dll (build 165)

Download coolmenu.zip (build 160) (PB9)(not changed for build 165)

Download exportfile n_coolmenu (build 160) (not changed for build 165)

 

 

(No) Warranty

This dll is provided "as is" with no expressed or implied warranty. The author accepts no liability if it causes any damage to your
computer or anything else vaguely within it's vicinity.