Download source program (version 1.01)
Update information
Only new features and bug-fixed are displayed bellow.
Please visit previous version 1.00 for more information.
- Function
Create() function has been changed to:
BOOL Create(CWnd*pMum,int iBmpID,int cx,int iBarID=-1,COLORREF clrBkgnd=RGB(192,192,192));
In version 1.00, the function is:
BOOL Create(CWnd*pMum,int iBmpID,int cx,int iBarID=-1);
clrBkgnd : transparent color of bitmap resource, similar to the color in CImageList
I developed 1.00 on Win98, but when I tested on XP, I found the problem: bitmap background is not transparent to COLOR_BTNFACE, this parameter allows to fit the color to COLOR_BTNFACE - automatically done by CImageList.
- Messages
A new message is added to the toolbar:
If user right clicks a button, the new message is distribute to parent window.
To process multiple messages in parent widow, a message class has to be used.
Message signature is:
message: WM_COMMAND, wParam: toolbar's ID (same as in version 1.00).
lParam: a pointer to class ToolbarMine::Message.
The inner message class contains following members:
class Message
{
public:
| UINT |
uMessage; |
//see bellow |
| int |
iIndex; |
//index of the button clicked |
| CRect |
rcButton |
//rectangle of the button clicked |
};
uMessage has 2 cases:
- WM_LBUTTONDOWN
It is the same as the only message in version 1.00.
Please note:
The message is actually distributed at WM_LBUTTONUP for independent buttons.
It is almost unnecessary to define new message constant, so I simply use this existing Windows constant.
This is similar to Windows' common buttons, which tell us a button is clicked rather than down or up.
- WM_RBUTTONDOWN
The message is distributed when user clicks a button by right-button of mouse.
Right-clicking a button does not change button situations (checked or pressed) at all.
The message allows us to do some interesting things with it.
In my application (not sample program), I display a popup menu associated with the message, which contains "Help", "Edit", "Submit" and "Close" menu items, so my application can offer more options with a button.
Please check source program for more.
7 interfaces on XP with different toolbar styles
(Every interface displays 14 toolbars which represent 14 button styles).
1. Toolbar style: NONE

2. Toolbar style: RAISED

3. Toolbar style: STRONG RAISED

4. Toolbar style: SUNKEN

5. Toolbar style: STRONG SUNKEN

6. Toolbar style: COLORED

7. Toolbar style: STRONG COLORED

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here