Вы находитесь на странице: 1из 3

How to use the Windows XP specific

windows styles with Xbase++


Basics
Windows XP has two version of its ComCtl32.dll. One (Version 5) containing the
original controls (from windows 95/98/Me/NT/2K), one (Version 6) containing the
advanced controls, which have been introduced with Windows XP.

How to use new styles with Xbase++


To use the XP specific themes the you have to tell Windows XP that the application
wants to use the new windows themes. This is done via a so-called manifest. This
manifest is an XML file which contains a lot of meta information such as version,
name, remarks, type, target processor and dependants of the application/executable.
In addition information about DLLs required including version of required DLLs is a
part of the manifest meta data. This meta information is used by the operating
system loader which loads the executable to start the application within its
required context.
The manifest file must be deployed with the .EXE and specially named, after the
.EXE. Example: in case the .EXE is named
myapplication.exe
then the manifest file needs to be named
myapplication.exe.manifest
The manifest file must contain the following code:
<?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="MyCompany.MyProduct.myapplication"
type="win32"
/>
<description>This is the My Application.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"

/>
</dependentAssembly>
</dependency>
</assembly>
The only properties you have to change are:
name="MyCompany.MyProduct.myapplication"
and
<description>This is the My Application.</description>
To deploy the manifest with the application one has the following options:
a) deploy the manifest file as file together with the .EXE or
b) link the manifest file as resource to the .EXE
Option a) is the easiest one: you simply copy the manifest file to the directory where
the .EXE resides and start the EXE, now the EXE should receive the new styles.
The problem is is that this does not work correctly when the EXE is installed on a
network drive. (Microsoft claims: this may work when installed with Windows
Installer Version 2, but this has not been tested yet).
Alaska Software therefore recommends to use option b.), create a resource file from
your manifest file and link this resource to your EXE file.
In case you are using Xbase++ 1.8 or higher, create a .ARC file which contains the
following code
#define MANIFEST_RESID 1
#define MANIFEST 24
USERDEF MANIFEST
MANIFEST_RESID FILE = "mdidemo.exe.manifest"
In case your application already has a resource file, simply add these lines to your
resource file of your application.
In case you are using Xbase++ 1.7 or earlier, you have to use the Microsoft RC.EXE
as ARC does not support manifest files:
myapplication.rc
The myapplication.rc file must contain the following code:
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
#define RT_MANIFEST 24

MANIFEST_RESOURCE_ID RT_MANIFEST "myapplication.exe.manifest"

Now link compile the resource file with ARC.EXE or RC.EXE and link it to your
application. In case you are using PBUILD you might add the .RC or .ARC file to your
project file.
NOTE: Alaska Software strongly recommends to upgrade your Xbase++ version to the
current top level. Windows XP themes are complicated to support with regard to
existing Windows controls. This is especially true when it comes to Window border
sizes and other implicit sizes of Windows controls which depend on the theme
selected. Newer Versions of Xbase++ have automated support for that type of
different visual appearance.

Вам также может понравиться