I wanted to try and write an article for the The Code Project and thought
this would be a good start. It's a little short but hopefully a few people will
find it useful. If you have any suggestions on the article let me know.
So what's it about?
This article will show you how to quickly and easily add the capability to
use themes under XP. This means whatever theme the user is using under Windows
XP will control the look of your application. See the example below:
Windows 95, 98, ME, 2000
One of the first things that need to be done to use XP Styles in your MFC
application is to create the manifest XML file for your application. You can
paste the following code into a new notepad document and save it in a file
called manifest.xml. Save this file in your project directory. It's not
required, but you can fill in the description and name of your application if
you would like.
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<description>Your application description here.</description>
Once that is completed, you will want to add the manifest.xml file to
your project in the resource editor. In Visual Studio 6, hit Ctrl+R to add a new
resource, select all files and double click manifest.xml to add the file.
When you see the custom resource dialog, enter the number "24" as the
resource type and hit OK. Once imported, right click on the resource to open the
properties window and change the ID to the number "1".
Just one line...
To initialize everything you need to call
in your program. I usually put this in the
but you can also use in the
InitDialog() and still have it work. It
should look something like this:
//Make sure this is here so you can use XP Styles
Now when you run your program you should see XP style controls in your
program, unless of course you have Windows XP set to the classic style which
then everything will pretty much look the same.
I want more info!
If you're looking for some more information on using XP themes in your code I
would recommend checking one of the best resources I have found for information
on MSDN. The page is here.