Click here to Skip to main content
15,881,882 members
Articles / Programming Languages / C++
Article

Add Windows XP Theme Style to your current projects

Rate me:
Please Sign up or sign in to vote.
4.84/5 (65 votes)
6 Sep 2001 608.2K   3.8K   132   145
Add Windows XP Theme Style to your current projects

Sample Image - xptheme.jpg

The following steps introduces XP Theme Style to your project:

  1. Insert Resource, choose "Custom", input "24" (without quotes) as resource type
  2. Copy and paste the following XML sheets into the editor.
    XML
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
    <assembly 
       xmlns="urn:schemas-microsoft-com:asm.v1" 
       manifestVersion="1.0">
     <assemblyIdentity 
        processorArchitecture="x86" 
        version="5.1.0.0"
        type="win32"
        name="test.exe"/>
     <description>Test Application</description>
     <dependency>
      <dependentAssembly>
        <assemblyIdentity
             type="win32"
             name="Microsoft.Windows.Common-Controls"
             version="6.0.0.0"
             publicKeyToken="6595b64144ccf1df"
             language="*"
             processorArchitecture="x86"/>
      </dependentAssembly>
     </dependency>
    </assembly>

    You can replace test.exe and Test Application with any string you like. This will not affect the behaviour of the application.

  3. Change resource ID to 1.
  4. Add calls to InitCommonControls() in your WinMain(). Don't forget to include commctrl.h and link comctl32.lib. Rebuild your project, all done :-)

This special resource type is only recognized by Windows XP. In any other version of Windows (Windows 9x/NT/2000), the program simply runs as before.

You can also create a manifest file with the same name of the EXE file, plus an extension .manifest, which contains the same lines as the ones above. For our test.exe, the manifest file is test.exe.manifest.

License

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


Written By
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralTips for VS 2005 Pin
Warren Stevens21-Mar-07 6:47
Warren Stevens21-Mar-07 6:47 
QuestionXp style problem in Visual Studio 2005 Pin
Vinod Moorkkan17-Feb-07 0:18
Vinod Moorkkan17-Feb-07 0:18 
AnswerRe: Xp style problem in Visual Studio 2005 Pin
KarstenK19-Feb-07 3:23
mveKarstenK19-Feb-07 3:23 
Generaleasier in VS2005 Pin
c_srishti23-Dec-06 17:23
c_srishti23-Dec-06 17:23 
GeneralRe: easier in VS2005 Pin
Member 423139120-Apr-09 23:18
Member 423139120-Apr-09 23:18 
GeneralTHANK YOU! THANK YOU! THANK YOU! THANK YOU! Pin
Master_God12-Nov-06 8:31
Master_God12-Nov-06 8:31 
GeneralSuch aGOOD WORK! Pin
Coolcute24-Sep-06 19:53
Coolcute24-Sep-06 19:53 
GeneralVS2005 Pin
James Poag19-Jul-06 2:57
James Poag19-Jul-06 2:57 
VS 2005 automatically generates manifest files with its manifest tool. This tools is enabled by defualt when you create a new project.

Following these directions will cause a resource collision error. There are two simple steps to resolve this:

1. Turn off this feature (loses manifest generation by code)

Project->Properties->Configuration Properties->Manifest Tool:

Set Embed Manifest to "No"

2. Use this code as an additional manifest (Best) by saving the code above in an xml file

Project->Properties->Configuration Properties->Manifest Tool->Input and Output

Add the code as an "Additional Manifest File"
GeneralRe: VS2005 Pin
sciencekrishnan22-Jul-09 1:43
sciencekrishnan22-Jul-09 1:43 
Generalx64 manifest Pin
gotomy4-Jun-06 13:39
gotomy4-Jun-06 13:39 
GeneralRe: x64 manifest [modified] Pin
gotomy6-Jun-06 11:59
gotomy6-Jun-06 11:59 
QuestionApplication configuration is incorrect Pin
Kinnos30-Jan-06 5:49
Kinnos30-Jan-06 5:49 
JokeRe: Application configuration is incorrect Pin
Fiberman14-Feb-06 20:43
Fiberman14-Feb-06 20:43 
GeneralRe: [ThnakYou!!]Application configuration is incorrect Pin
eojun8125-Dec-06 5:39
eojun8125-Dec-06 5:39 
GeneralRe: Application configuration is incorrect Pin
Anil K P20-Feb-07 4:04
Anil K P20-Feb-07 4:04 
GeneralStrange behaviour when changing the editbox control color Pin
yttham7-Jan-06 23:08
yttham7-Jan-06 23:08 
GeneralRe: Strange behaviour when changing the editbox control color Pin
yttham9-Jan-06 3:00
yttham9-Jan-06 3:00 
QuestionAdd XP Theme Style to Visual C++.NET Pin
C_W_S1-Dec-05 9:41
C_W_S1-Dec-05 9:41 
AnswerI Would Like to Know As Well Pin
rayquan22-Mar-06 11:20
rayquan22-Mar-06 11:20 
AnswerRe: I Would Like to Know As Well Pin
bryan.yoo12-Jun-06 4:29
bryan.yoo12-Jun-06 4:29 
GeneralRe: I Would Like to Know As Well Pin
Neounk11-Aug-07 2:22
Neounk11-Aug-07 2:22 
GeneralVery nice! Pin
GeVanCo8-Oct-05 8:48
GeVanCo8-Oct-05 8:48 
QuestionHow to do this &quot;on the fly&quot;? Pin
dc_20005-Aug-05 23:03
dc_20005-Aug-05 23:03 
AnswerRe: How to do this &quot;on the fly&quot;? Pin
D0lph|n7-Sep-05 7:02
D0lph|n7-Sep-05 7:02 
GeneralStep #3 Pin
daDude29-Jan-05 12:53
daDude29-Jan-05 12:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.