Windows XP Manifest in Delphi
Find out how you can include the manifest into a Delphi project to allow your application to share the same look and feel of Windows XP. | |||||||||||||||||||
Article submitted by: Michael A. Allen Why? Windows XP has a theme manager that changes the look and feel for most all of the standard windows controls. Microsoft claims that older versions of the comctl32.dll contained support code to maintain different platforms of the Windows OS. The introduction of "themes" in Windows XP was the rationale behind cleaning up the code contained within the comctl32.dll. Now they are maintaining two versions of the same control. The older (version 5.8) version which is backward compatible to all flavors of Windows (XP included) and the newer (Version 6) version which is compatible with XP alone (and any future windows platforms). By default, all programs written under Windows XP will default to version 5.8, maintaining the same look and feel of the legacy windows applications. In order to enter 6.0 of the control, you must include in your application, a Manifest that the OS will read in order for the theme manager to take control of drawing the new look and feel for the Windows XP environment. What? What exactly is the manifest, and how does this play into making my application use version 6.0 of the comctl32.dll library? The manifest is an XML document that must be included into the resource section of your executable. Typically this resource section is reserved for things like images, icons and mouse cursors. Even string tables can be included in this resource section. The XML document, when placed in the right spot within the resource section will allow Windows XP to decide which version of the comctl32.dll to use when binding. How? To include this XML manifest into your application, you must first know the constants set forth by Microsoft. When entering a new resource into your executable, there is a group number and item number associated with the resource. The group number is typically labeled with a friendly name. For instance, if you use your resource explorer demo application that came shipped with Delphi (under {$delphi}\Demos) you will notice groups named "Strings", "Bitmaps", "Icons" or "Cursors" - these names are actually just friendly representations of a group number. The group number for "Manifests" is 24, as per the C headers distributed by Microsoft. The manifest item number to determine the version of the comctl32.dll library is 1 (also per the C headers distributed by Microsoft). This information becomes necessary when building our new resource (.RES file) to be linked in with our executables. To create the .RES file that we need, we need to first create a .RC file that assigns our manifest XML document to the appropriate group number and line item number. In the ZIP file included with this document, you'll notice two files: 1) WindowsXP.RC and 2) WindowsXP.Manifest The WindowsXP.RC contains our instructions to include the WindowsXP.Manifest (XML) document as line item 1 bound to group 24. The contents of the WindowsXP.RC looks like this: 1 24 "WindowsXP.Manifest" The manifest itself, is an XML document that contains information about the application you are writing as well as information concerning the version of the comctl32.dll to use. It's contents will require a certain amount of customization to fit your application, but will look similar to this:
Now that we have these two files in place, we need to use Delphi's resource compiler to compile the .RC file. Doing so will result in a WindowsXP.RES file that we can include in our applications. From the command line, type following (keep in mind, you should include the Delphi's BIN directory in our path for this to work) C:\Project1> brcc32 WindowsXP.RC After you have compiled the WindowsXP.RC file, you see a WindowsXP.RES file in the same directory. The final step to making your application Windows XP compatible is to include this resource in your application. The easiest way to do this, is to include either in your project file (.DPR) or your primary form, the following compiler directive: {$R WindowsXP.RES} You should probably place this immediately after the {$R *.DFM} compiler directive that is already in your application, directly after the implementation clause. Once you have included your WindowsXP.RES file into your application, compile your application and run it. The Windows theme manager, to adapt the same look and feel of other applications written for Windows XP, now instantly converts your windows controls. Warnings Microsoft warns all developers that they have in fact eliminated a lot of the support code in the comctl32.dll library, and that you should always test thoroughly to ensure all aspects of your controls work properly before distribution. It has been my experience that there are in fact some compatibility issues with Delphi. So far, the only discrepancy I have found was in the TListView component. If you use the TListView component with the view style of vsReport, you run into a problem using the TColumns property. During runtime, you will generate a kernel error if you attempt to use column headers with said view style. If you need some more help on this subject, please post your comments to the Delphi Programming Forum. In any case, download the demo project - and try it for yourself. |
All graphics (if any) in this feature created by Zarko Gajic.
More Delphi |
· Learn another routine every day - RTL Quick Reference. · Download free source code applications and components. · Talk about Delphi Programming, real time. · Link to the Delphi Programming site from your Web pages. · Tutorials, articles, tech. tips by date: 2001|2000|1999|1998 or by TOPIC. |
· NEXT ARTICLE: Perfect Gift: Delphi 6 and Kylix (almost) for FREE. For a limited time only, Borland Cross-Platform RAD is available to Visual Basic developers at the special price! Buy Delphi 6 professional at the half price and get Kylix Desktop and Delux Standard for FREE. |
Windows XP Manifest in Delphi的更多相关文章
- MFC应用程序配置不正确解决方案(manifest对依赖的强文件名,WinSxs是windows XP以上版本提供的非托管并行缓存)
[现象] 对这个问题的研究是起源于这么一个现象:当你用VC++2005(或者其它.NET)写程序后,在自己的计算机上能毫无问题地运行,但是当把此exe文件拷贝到别人电脑上时,便不能运行了,大致的错误提 ...
- windows XP系统内核文件分析(全)
Windows XP个别 System32 文件 System32 文件夹下个别要移除的文件 我们就要删除另外600 个 system32 文件...我们要一次把它们全都解决掉. 以下是我所删除的 S ...
- 在vc6.0下编的对话框界面如果没做过其他处理,往往显的很生硬,怎么样才能使他有Windows XP的风格呢,其实也很简单,我们来看看下面两种方法。
在vc6.0下编的对话框界面如果没做过其他处理,往往显的很生硬,怎么样才能使他有Windows XP的风格呢,其实也很简单,我们来看看下面两种方法. 方法一: 1.首先确认你在Windows ...
- windows XP上实现python2.7.5和python3.4.3共存
windows XP上实现python2.7.5和python3.4.3共存过程记录: 1. 首先安装python2.7.5和python3.4.3,两个版本安装顺序不分前后; 2. 检查系统环境变量 ...
- windows XP 神key
微软内部泄露的XP的CD-KEY和无限次激活码!亲测!!! Windows XP专业版最新注册码HTXH6-2JJC4-CDB6C-X38B4-C3GF3RT4H2-8WYHG-QKK6K-WWHJ2 ...
- Windows XP系统下添加任务计划常出现问题解决办法
Windows XP系统下添加任务计划常出现问题解决办法 计划任务就是让电脑在指定的时间内执行指定的动作(计划动作),这些动作可以是一个程序,也可以是一个批处理,但是至少是可以运行的(通俗一些就是双击 ...
- win7下安装和使用Windows XP Mode
如果想在电脑中安装多个操作系统有几种方法: 1.安装虚拟机,继而在虚拟机中安装操作系统.虚拟机个数就相当于电脑个数,常用的虚拟机软件有VMVare,VMVare功能齐全,但是安装文件较大. 2.如果你 ...
- 【转】如何使用VS 2013发布一个可以在Windows XP中独立运行的可执行文件
问题描述: 用VS2013写好一个程序,在本机上运行一切正常.但是如果直接把exe文件放到另一台机器上用,则会出现: Windows XP:不是一个正常的win32程序 Window 7:缺少msvc ...
- Linux与Windows xp操作系统启动过程
Linux启动过程: 第一步,加载BIOS,当你打开计算机电源,计算机会首先加载BIOS信息,BIOS信息是如此的重要,以至于计算机必须在最开始就找到它.这是因为BIOS中包含了CPU的相关信息.设备 ...
随机推荐
- win10 无法打开 APICloud Studio 2 的解决方案
坑爹. 新搭建了系统 apicloud studio2 打开无反应 无任何报错提示 双击没有方案.弄了一天 最后搞定. . 百度搜索 win10 null.sys 替换进去 C:/Win ...
- window BIOS设置硬盘启动模式
bios如何设置硬盘启动模式?BIOSD硬盘模试主是要针对IDE接口的硬盘和SATA接口的硬盘来设置的.以前的主板只支持一种类型.现在的智能笔记本主板支持:IDE Mode.AHCI Mode.下 ...
- 【linux】监控磁盘情况并自动删除备份文件
背景:我有一个备份目录/home/kzy/bakup,会每天备份一些信息.随着日子一天天的过去,这个文件夹越来越大,终于把磁盘撑满了..... 需求:当磁盘占有率超过80%时自动删除该文件夹下最老的3 ...
- 安装配置tomcat,java运行环境
1.下载JDK,安装 官网下载地址:http://java.sun.com/javase/downloads/index.jsp 下载后,安装,选择你想把JDK安装的目录: 比如:JDK安装目录:E: ...
- .NetCore中如何实现权限控制 基于Claim角色、策略、基于Claim功能点处理
.NetCore中如果实现权限控制的问题,当我们访问到一个Action操作的时候,我们需要进行权限控制 基于claims 角色控制 基于角色控制总觉得范围有点过大,而且控制起来感觉也不是太好,举一个例 ...
- elasticflow
https://github.com/robcowart/elastiflow/blob/master/INSTALL.md
- flask 封装
#!/bin/env python# _*_coding:utf-8_*_#!!!!!!!!!!!!describe:this script shoud install python-devel an ...
- 喊山 BFS
一个山头呼喊的声音可以被临近的山头同时听到.题目假设每个山头最多有两个能听到它的临近山头.给定任意一个发出原始信号的山头,本题请你找出这个信号最远能传达到的地方. 输入格式: 输入第一行给出3个正整数 ...
- java文件压缩与解压
感谢“zlex.dongliang@gmail.com”.主要代码如下: import java.io.BufferedInputStream; import java.io.File; import ...
- 支付宝app支付服务端流程
支付宝APP支付服务端详解 前面接了微信支付,相比微信支付,支付宝APP支付提供了支付封装类,下面将实现支付宝APP支付.订单查询.支付结果异步通知.APP支付申请参数说明,以及服务端返回APP端发起 ...