ProgressBars Style (C++ win32)

Hiya, I have a small question with progress bars. I have no problem setting range, colors, and setting position and all, however I do have a question on its overall appearence

I use ResEdit to create my RC files, and when i press F5 to preview the dialog, I get something like this: http://imgur.com/QaLxq

However when I compile my program and run it, the proggress bars appear like so: http://imgur.com/w0I4D

I would like my progress bars to appear in the same visual style as they do in ResEdit, so what's the best way to get to this?
You can try adding a manifest file to your resource file (or if you are using MSVC directly to your project).
If using MSVC - Copy the text below to a file called for example mymanifest.manifest - notice the file extension - and see if that helps.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="1.0.0.0"
    processorArchitecture="X86"
    name="exename"
    type="win32"
/>
<description>Application Description</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
</assembly>
Last edited on
Do not forget to call first InitCommonControlsEx() with IDC_PROGRESS style also in your code.
For this to work you need to define _WIN32_WINNT to 0x0501 to target windows xp or later.

If you are using Visual Studio, put this in stdafx.h, there is NO NEED for using manifest files and also NOT need to call InitCommonControlsEx():
1
2
3
4
5
6
7
8
9
10
11
// enable XP themes
#define ISOLATION_AWARE_ENABLED 1
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='X86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif 


This is only tested in VS2010.
Last edited on
Isn't that pretty much what is in the manifest file anyway??
Thanks guys, that does give me that style I want, however is it possible for me to change the color?

For example, here's the player's status window with the XP styles that you guys gave via manifest: http://imgur.com/s5QxZ

And here's the default that I was using before: http://imgur.com/Ls4ri

As you can see, the default has colors (which i specfy with SendMessage(ProgressBar, PBM_SETBARCOLOR, 0, RGB);)

So I'm guessing PBM_SETBARCOLOR command doesn't work when those styles are enabled? =\
Looks that way.
Swings and roundabouts as they say.
Damn, what a shame.

Well many thanks =)
Topic archived. No new replies allowed.