Recipe 4.11. Forcing Older Programs to Use Windows XP Common Controls


Problem

You want programs written for earlier versions of Windows to use the rounded, XP-type common graphical controls for things such as checkboxes and buttons. Normally, when you run an older program in XP, the operating system applies an XP-type frame around it, with rounded title bars. But the older program itself still uses its older style interface.

Solution

To force older programs to use XP-type common controls, you have to create a manifest file a specifically formatted XML file and place it in the same folder as the older program.

The manifest file should be almost exactly the same for each older program that you want to use XP common controls, changing only the name and description of the program itself.

Following is the code to put in your manifest file. Note that for "Description of Program" you should enter a description for the program, and for "Program Name" you should enter the name of the program.

To create the file, open Notepad, type the following text into it, and save it to the same folder as the executable file of the program you want to force to use XP common controls. Give it the same name as the program's executable file, but with an extension of .manifest. So, for example, if the program's executable file were named oldprogram.exe, you'd give the manifest file the name oldprogram.exe.manifest.

Use the following code to create a .manifest file to force an older program to use XP common controls:

<?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="Program Name"     type="win32" /> <description>Description of Program</description> <dependency>     <dependentAssembly>         <assemblyIdentity             type="win32"             name="Microsoft.Windows.Common-Controls"             version="6.0.0.0"             processorArchitecture="X86"             publicKeyToken="6595b64144ccf1df"             language="*"         />     </dependentAssembly> </dependency> </assembly>

Discussion

When you create the manifest file, the program will not only use XP common controls in the older Windows application, but will also apply whatever current XP theme you're using. If you don't want to use the XP common controls any longer, delete the manifest file or rename it. Also, keep in mind that the manifest file will not necessarily work with every older Windows application, such as old versions of Microsoft Money.

See Also

If you want to force an older Windows program to use XP's common controls, but don't want to have to go through the trouble of creating a manifest file, you can download XPME for Windows from http://www.tlhouse.co.uk/XPME.shtml. Run it and select the program that you want to use common controls. The program automatically creates a manifest file for you. XPME is freeware.



Windows XP Cookbook
Windows XP Cookbook (Cookbooks)
ISBN: 0596007256
EAN: 2147483647
Year: 2006
Pages: 408

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net