Click here to Skip to main content
15,891,184 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 611K   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

 
GeneralRe: Core API Application and manifest Pin
AJKR7-Oct-03 3:43
AJKR7-Oct-03 3:43 
Generaladd windows xp theme style to your WebBrowser Pin
Leo Wang20-Jun-02 23:21
Leo Wang20-Jun-02 23:21 
GeneralMy OCX does not take XP style ! Pin
Emmanuel Derriey20-Jun-02 22:52
Emmanuel Derriey20-Jun-02 22:52 
GeneralRe: My OCX does not take XP style ! Pin
Anonymous20-Jul-02 21:45
Anonymous20-Jul-02 21:45 
QuestionHow about DLL? Pin
5-May-02 5:21
suss5-May-02 5:21 
AnswerRe: How about DLL? Pin
8-May-02 20:08
suss8-May-02 20:08 
GeneralRe: How about DLL? Pin
16-May-02 20:05
suss16-May-02 20:05 
GeneralRe: How about DLL? Pin
14-Jun-02 12:09
suss14-Jun-02 12:09 
I followed your code for a DLL in Visual C++.NET and it worked perfectly. Then I tried the original posting's solution --- this time for a VC6 MFC executable, and again, all worked perfectly.

I then tried your code with an ATL Composite Control DLL project in VC6 and, no matter what I did, it never behaved. Assuming that the problem was VC6 and/or an older Platform SDK, I ported the VC6 project into .NET and tried again. Once again, the composite control DLL doesn't display correctly. I am guessing there is a difference in either the project or framework which causes the manifest to be ignored. Any help would be appreciated, especially with respect to building the VC6 DLL.

Thanks, RPR

RPR
GeneralAsked and answered Pin
21-Jun-02 5:54
suss21-Jun-02 5:54 
GeneralI cannot make it work Pin
namth20-Nov-02 8:39
namth20-Nov-02 8:39 
GeneralRe: I cannot make it work Pin
JustAGhost24-Oct-03 5:14
JustAGhost24-Oct-03 5:14 
GeneralRe: How about DLL? Pin
Frederic Marceau15-Apr-04 8:41
sussFrederic Marceau15-Apr-04 8:41 
GeneralHow it works Pin
beaster21-Jun-05 9:22
sussbeaster21-Jun-05 9:22 
Generalprobleme with tabctrl Pin
4-Apr-02 8:31
suss4-Apr-02 8:31 
GeneralRe: probleme with tabctrl Pin
16-Jun-02 10:49
suss16-Jun-02 10:49 
GeneralRe: probleme with tabctrl Pin
16-Jun-02 10:54
suss16-Jun-02 10:54 
GeneralRe: probleme with tabctrl Pin
Tibor Blazko11-Jun-03 20:26
Tibor Blazko11-Jun-03 20:26 
GeneralSOLVED! Re: probleme with tabctrl Pin
mediamaster4011-Nov-02 11:21
mediamaster4011-Nov-02 11:21 
GeneralRe: SOLVED! Re: probleme with tabctrl Pin
Tibor Blazko11-Jun-03 22:27
Tibor Blazko11-Jun-03 22:27 
GeneralRe: SOLVED! Re: probleme with tabctrl Pin
ralfsch25-Jan-05 5:42
ralfsch25-Jan-05 5:42 
GeneralRe: is it really a bug? Pin
Tibor Blazko6-Jun-03 3:40
Tibor Blazko6-Jun-03 3:40 
QuestionOwnerdraw detect XP or Win9x? Pin
3-Apr-02 20:00
suss3-Apr-02 20:00 
QuestionHow to do this in C#? Pin
Domenic Denicola9-Mar-02 18:12
Domenic Denicola9-Mar-02 18:12 
AnswerRe: How to do this in C#? Pin
10-May-02 23:51
suss10-May-02 23:51 
GeneralFlat Scrollbars Pin
Takeru Koushirou18-Feb-02 11:03
Takeru Koushirou18-Feb-02 11:03 

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.