Bob Moore's Coding Tips

76. How do I add a manifest to a VC6 application?

A manifest is a set of meta-information about your application. Manifests are important when it comes to getting your application visually themed under XP, and more important still in the brave new world of Vista. If you're using a flavour of VS.Net, they directly support manifest resources. But what if you're using VC6? Fortunately, there is a way that VC6 can be persuaded to apply a manifest.

First of all, create your manifest file. This is simply an XML text file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly
  xmlns="urn:schemas-microsoft-com:asm.v1"
  manifestVersion="1.0">
<assemblyIdentity
   name="MyApplicationName"
   processorArchitecture="x86"
   version="5.1.0.0"
   type="win32"/>
<description> My System </description>
 <dependency>
  <dependentAssembly>
   <assemblyIdentity
     type="win32"
     name="Microsoft.Windows.Common-Controls"
     version="6.0.0.0"
     processorArchitecture="x86"
     publicKeyToken="6595b64144ccf1df"
     language="*"/>
  </dependentAssembly>
 </dependency>
</assembly>

Remember to change the MyApplicationName and My System entries to something more appropriate. It's not strictly necessary for theming purposes, but doubtless Vista will have its own traps waiting if you don't. Now go to your project resources, select Insert~Resource from the menu, and press the custom button. When you're asked for a resource type, enter 24. Insert the XML given above into the resource, then rename the resource to have the ID 1. I also change the stored filename to manifest.bin, just to make it obvious what's going on.

Now rebuild your application, and you have a manifest resource. If your application wasn't themed before, it should be now.