• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1138
  • Last Modified:

How do I get CreateToolbarEx() to take TBSTYLE_FLAT in order to make my toolbar a coolbar without it behaving as if I also specified TBSTYLE_TRANSPARENT?

How do I get CreateToolbarEx() to take TBSTYLE_FLAT in order to make my toolbar a coolbar without it behaving as if I also specified TBSTYLE_TRANSPARENT?

My problem is that when I add TBSTYLE_FLAT to my toolbar (that was working fine beforehand)...

      hWndToolbar = CreateToolbarEx(
            hwndParent,             // parent
            //WS_CHILD | WS_BORDER | WS_VISIBLE | TBSTYLE_TOOLTIPS,
            WS_CHILD | WS_BORDER | WS_VISIBLE | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT,
            ID_TOOLBAR,             // toolbar id
            //DB increased next line to add buttons
            //24,                     // number of bitmaps
            26,                     // number of bitmaps (i.e. number of non-separator buttons)
            hInst,                              // mod instance
            IDB_TOOLBAR,                  // resource ID for bitmap
            (LPCTBBUTTON)&tbButtons,// address of buttons
            //DB adjusted number in next line to accomodate above adjustments
            //32,                     // number of buttons (including separators)
            34,                     // number of buttons (including separators)
            16,16,                  // width & height of buttons in pixels
            16,16,                  // width & height of bitmaps in pixels
            sizeof(TBBUTTON));      // structure size

... the resulting coolbar has a white/transparent background with hovering not working properly. I want a grey background such as appears in the background of Office 2003.

I read on the Web that there is a bug where TBSTYLE_FLAT wrongly invokes TBSTYLE_TRANSPARENT as well automatically, and a solution is to unload TBSTYLE_TRANSPARENT afterward... but I don't know how to do that.

0
davidbermancom
Asked:
davidbermancom
1 Solution
 
Jase-CoderCommented:
set the constant _WIN32_IE to 0x0600

#define _WIN32_IE 0x0600
#include <commctrl.h>

use the above if you have

"The application is compatible with Comctl32.dll version 6.0 and later, and Shell32.dll and Shlwapi.dll version 6.0 and later. The application cannot implement features that were added after version 6.0 of Comctl32.dll, or version 6.0 of Shell32.dll and Shlwapi.dll." - msdn

or

#define _WIN32_IE 0x0501
#include <commctrl.h>

use this if:

"The application is compatible with Comctl32.dll version 5.81 and later, and Shell32.dll and Shlwapi.dll version 5.0 and later. The application cannot implement features that were added after version 5.81 of Comctl32.dll, or version 5.0 of Shell32.dll and Shlwapi.dll." - msdn

you can test versions of dlls by using:

if(GetDllVersion(TEXT("comctl32.dll")) >= PACKVERSION(5,81))
{

}

0
 
mrblueCommented:
I found the following solution in Internet:

http://www.powerbasic.com/support/forums/Forum4/HTML/003071.html

1. Do not use TBSTYLE_FLAT in CreateToolbarEx()

2. Set it (TBSTYLE_FLAT) after CreateToolbarEx()

 ::SetWindowLong(hWndToolbar, GWL_STYLE, ::GetWindowLong(hWndToolbar, GWL_STYLE) | TBSTYLE_FLAT);
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now