How to Enable XP/Vista themes in your Dialog?

30 12 2008


From Windows XP onwards, the basic control look and feel have improved drastically. Previously, they were merely flat style controls without any effects- the maximum you can do is to change the control color and mouse cursor icon( I hope you do remember the Jungle Theme of those old win98 days). In Vista its even more stylish. But is it possible to give the same look & feel effects to our applications as well?

xp_themes


Yes. You can. You just have to add a manifest file to your application. Well follow the detailed steps about how to do it. Well, we are going to apply Vista look and feel to the following dialog. 😉

xp_theme_7

1) The manifest format is specified below. Copy it to notepad and change the “ExeName” to the name of your application. For instance if your exename is Rabbit.exe, then “ExeName” is “Rabbit”.

<?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>

2) Now insert a new resource.

xp_theme_1
3) Now add a new Custom Resource with Resource ID as 24.

xp_theme_2

4) Now copy-paste the manifest contents to new resource and save it. Make sure you’ve changed the “ExeName” to your application name.

xp_theme_3

5) Now take the properties of our new resource –  “IDR_DEFAULT1”.

xp_theme_4

6) Now change the Resource ID to “1“.

xp_theme_5

7) That’s it. Now compile and run the application. And now see the command buttons in Vista Style. Cool! isn’t it?

xp_theme_6


I searched a lot for the screenshot of the old “Jungle Theme” of Windows 98. Its a pity that I couldn’t find it. 😦 If you find one such, please do notify. I’m getting nostalgic. 😉


Targeted Audience – Intermediate.

Advertisements

Actions

Information

6 responses

13 01 2009
ganesh

I tried this vista method, but it not working in my dialog.
I have VC6 and winxp.
Is there anything i miss ?

18 01 2009
Jijo.Raj

Hi Ganesh,

First of all, I’m really sorry for the late reply. Ideally just following the steps is enough. well, please make sure that you have copied the entire content of xml. Its better to copy/paste to notepad and then to resource. Well, make sure, you have updated the correct exe name to the manifest. If you still have problems, please feel free to get back again.

Regards,
Jijo.

20 01 2009
ganesh

Dear jijo,

Could you send one sample application to my mail id?

Bcoz still i can’t make that vista theme in dialog.

23 02 2009
Augustin

Hi,

I am using Windows XP and VC6. I am getting XP theme in the dialog box for all the controls but the theme doesn’t apply to the created edit boxes. Is there any way to rectify this? Please suggest.

28 02 2009
Jijo.Raj

Hello Augustin,

Unfortunately i don’t have an XP box with me right now. I’ll check it at my office pc, by this monday and will get back to you. Or did you already solved your problem?

Regards,
Jijo.

28 02 2009
Augustin

Hi Raj,

No, I have not solved the problem yet! Please let me know once you have solved the issue!

Thanks,
Augustin

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s




%d bloggers like this: