|
Thanks .. it is very useful. Could you please explain the following steps
1. choose "Custom", input "24" (without quotes) as resource type
Why 24 why not 26 or 34
2. Change resource ID to 1. Why?
Thanks
|
|
|
|
|
In "winuser.rh" of the latest version of Platform SDK, include the following lines:
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define RT_MANIFEST 24
Is this make sense?
Alan Wen
|
|
|
|
|
Yes!
Thanks Alan...
-Mona
|
|
|
|
|
don't support chinese (GB2312)
|
|
|
|
|
If I try this on a standard MFC application, the toolbar doesn't seem to be repainted properly. Anyone know how to solve this?
|
|
|
|
|
I am having the same problems... could someone please help us out?
|
|
|
|
|
I found out that if I have no borders and no gripper on the toolbar it looks ok.
|
|
|
|
|
Well, no toolbar will work too. hehe, but I want a gripper and border... there must be a way to fix this.
|
|
|
|
|
Use Create instead of CreateEx when creating the toolbar. This worked for me.
|
|
|
|
|
Create() just calls CreateEx() with 0 for dwCtrlStyle and zero borders. Did you mean calling Create() works, in other words it works if you don't have a flat toolbar with a gripper, or did you mean that you can create the same toolbar (with flat appearance and gripper) using Create()?
I've search at microsoft.com, on usenet, and nobody else mentions the trouble with toolbars or the solution. Is everybody just waiting for SP6 or VC++ 7 to fix the problem?
|
|
|
|
|
I had the same issue. They I changed the method to using the manifest file, rather than including the resource, and it works much nicer.
|
|
|
|
|
I dunno if you guys have figured this out... but I found a way to fix this. Use the TBSTYLE_FLAT | TBSTYLE_TRANSPARENT only if themes are not being used. See http://www.codeproject.com/useritems/themewrapper.asp for more info.
cheers,
swinefeaster
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
TBSTYLE_FLAT | TBSTYLE_TRANSPARENT helped but I still wanted the border and left had docking grip thing.
My Solution, in addition to the above:
Subclass CToolBar and add a message handler for ON_WM_ERASEBKGND in which you paint a filled rectangle with the system colour COLOR_3DFACE from 0,0 to the height and width of the toolbar.
This works for me but causes flicker when resizing the window, better than the mess before though.
Matt
|
|
|
|
|
Okay, now this works. If you do this you don't need the omit the TBSTYLE_FLAT flag if on XP with themes on. Just fill the toolbar with the COLOR_3DFACE color and all is well.
True, there is some flicker when you resize, but it's not much worse than what I see from the status bar and dialog bars, and Microsoft's menus and toolbars (in Visual Studio) flicker too.
|
|
|
|
|
For me, this problem occured when I had the style TBSTYLE_FLAT set. So what I did was NOT setting this style if COMCTL32.DLL version was 6 or above... I have only tested this on XP though.
/Fredrik
|
|
|
|
|
This is exactly what I did. I thought it worked okay, but then I set Windows XP to use the classic Windows look instead of the new theme, and then saw that the toolbar didn't get painted correctly. So, this solution doens't work either.
Believe it or not, this problem still exists in the brand new Visual Studio .NET that I just got. Build a generic MFC app using the app wizard and the gripper is painted in the wrong color. Amazing. I'm what they call a Microsoft apologist, but now I'm seriously upset at this. I can't ship my app if the toolbar looks like this. Idiots.
|
|
|
|
|
If you want a toolbar with gripper and borders and you want it to repaint correctly on Windows XP with either one of the new visual styles or with the classic Windows look, do this:
Instead of
m_wndToolBar.CreateEx(...);
write
m_wndToolBar.SetBorders(1, 1, 1, 1);
m_wndToolBar.Create(...);
m_wndToolBar.ModifyStyle(0, TBSTYLE_FLAT);
For me this solves all the repaint problems I was having and there's no need to use any of the other tricks discussed above (which don't work in all cases anyway).
|
|
|
|
|
Just tried this with both VS 6 and VS .NET and it works in both cases. Amazing. My toolbar problems are solved.
|
|
|
|
|
can any any body tell me the system metric of the highlight box around the tool bar icon (and text) is.. I want to make my panel auto size to correctly work depending on the theme as some themes seem to put a wider boarder around it..
cheers
Chris
|
|
|
|
|
I found this article at Google which solved the problem...
>>>>>
We need to call the theme APIs to draw the custom user control. In this
case, MFC framework calls CControlBar::DrawGripper (barcore.cpp) in
WM_NCPAINT. However, it draws the gripper without erasing the background,
and the problem occurs. To solve this problem, we can:
1. Inherit CToolBar and add the OnNcPaint handler.
2. Copy the implementation of OnNcPaint from CControlBar::EraseNonClient in
barcore.cpp.
3. Before calling DrawGripper, call CDC::FillSolidRect to erase the
background.
Note: In step 3, you may also want to use theme APIs (DrawThemeBackground)
to draw the background. This way, the gripper will have the consistent
appearance as other theme enabled controls.
I hope this helps.
Best Regards,
Leo Chen
|
|
|
|
|
How can I implement in NON-WinXP System?
|
|
|
|
|
It is XP only. The only thing that resource does is to bind COMCTL32.DLL version 6.0 and UXTHEME.DLL to the application.
In Windows 9x/NT/2000, COMCTL32.DLL version 6.0 is not available. So you have to own-draw all controls.
|
|
|
|
|
|
I thought that CodeGuru's articles will have some insight into things but this one is just documentation cut'n paste. It would be nice to notice how to do it for DLLs that are linked from other processes (it's on the same page) and that if one defines ISOLATION_AWARE_ENABLED 1 (which is a bug in the docs, the define has to define a value, not just the name) the resulting code will not work on some (mostly Windows 98) systems.
|
|
|
|
|
Here you can download some classes for XP Ownerdraw support (ATL/WTL)
www.vromanov.com/files/XpTheme.zip
XpOwnerdarw Button test application. This application will work on XP and old systems.
www.vromanov.com/files/Button.exe (16K)
Small shell extension with XP Themes support (file descriptions support)
www.vromanov.com/files/regetex.htm
|
|
|
|