IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
Delphi
Search Delphi Group:

Advanced
-Collapse +Expand Delphi To/From
To/FromCODEGuides
-Collapse +Expand Delphi Store
PRESTWOODSTORE

Prestwood eMagazine

April Edition
Subscribe now! It's Free!
Enter your email:

   ► KBProgrammingDelphi for W...Using Data   Print This     
  From the December 2009 Issue of Prestwood eMag
 
Delphi Using Data:
Get the XP Look in Older Versions of Delphi
 
Posted 13 years ago on 7/2/2007 and updated 1/24/2008
Take Away:

Windows XP incorporates a "theme manager," and includes a newer version of comctl32.dll. Together, they help produce the unique XP Look. Later versions of Delphi are equipped to take advangage of this. But what if you have to maintain a Delph 5 application, and would like to spruce it up to look like a real XP program?

KB100641

What you need is known as an "XP Manifest."  Newer Versions of Delphi include a non-visual TXPManifest component (it's on the Win32 tab of the component palette).  Drop it on your main form, and your entire program takes on the rounded corners, etc.

If your version of Delphi lacks the TXPManifest component, all is not lost.  You can still "sneak" an XP Manifest into your executable.  And it's actually pretty easy.

The first thing is the XML that comprises the manifest.  Here it is:

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

Save the above in a file named "WindowsXP.Manifest."

The next thing you need is a Windows Resource Source file.  It's a plain text file, with a single line:

1 24 "WindowsXP.Manifest"

Save that in a file named "WindowsXP.RC."

Running this command, "brcc32 WindowsXP.RC" will compile your RC and produce a resource file named "WindowsXP.res."

The last step is to get that resource linked into your executable. 

Include this directive,  {$R WindowsXP.RES}, in either your project's main source file - or in the source file for your main form. 

A good place for it is after the {$R *.DFM} directive right below the Implementation clause.

Compile and link your application, run it under XP - and see the difference.

More Info

KB Post:  Application Manifests, Revisited for Vista

Comments

0 Comments.
Share a thought or comment...
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P136A1
Enter key:
Article Contributed By Wes Peterson:

Wes Peterson is a Senior Programmer Analyst with Prestwood IT Solutions where he develops custom Windows software and custom websites using .Net and Delphi. When Wes is not coding for clients, he participates in this online community. Prior to his 10-year love-affair with Delphi, he worked with several other tools and databases. Currently he specializes in VS.Net using C# and VB.Net. To Wes, the .NET revolution is as exciting as the birth of Delphi.

Visit Profile

 KB Article #100641 Counter
9938
Since 4/2/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2020 Prestwood IT Solutions.   [Security & Privacy]