首先,我必须说明一下:以下说的xp风格程序并非可以运行在任何win32平台上,而是在windows xp下运行的。有的朋友可就纳闷了,任何在windows xp下运行都有xp风格嘛,为何要花功夫去“实现”。请先看看下面两幅图
图1
图2
在开发时实现
怎么样?应该明白其中的区别了吧。为什么会这样?因为微软为windows xp提供了themes服务。themes可以让程序具有“xp风格”,看起来更美观,因为微软更新了comctl32.dll(ver 6.0)这个“xp风格”的控件。微软还为了保留传统的windows界面风格,特地留下了comctl32dll v5.8。图1就是v5.8绘制的,而图2则是支持themes的v6.0之作。有些朋友一定知道在vc7中建立mfc工程,程序会自动引入xp风格。vc6或者其他编译器呢?其实原理都一样的。首先建立一个文件,名为“.manifest”(是任何字符,manifest是扩展名。)
用文本输入以下是内容:<﹖xml version=″1.0″ encoding=″utf-8″ standalone=″yes″﹖>
<assembly xmlns=″urnschemas-microsoft-comasm.v1″ manifestversion=″1.0″>
<assemblyidentity processorarchitec ture=″x86″ version=″5.1.0.0″ type=″win32″
name=″yourappli cation.exe″/>
<description>de scrptions</description>
<dependency>
<dependentassembly>
<assemblyidentity
type=″win32″
name=″microsoft.windows.common-controls″
version=″6.0.0.0″
publickeytoken=″6595b64144ccf1df″
language=″″
processorarchitec ture=″x86″/>
</dependentassembly>
</dependency>
</assembly>
保存以后,在编译器中导入此文件。资源类型是24(其实就是rt_manifest),id是1(必须)。若不能正常运行,请添加以下代码。//…
#pragma﹖commentlib﹖″comctl32.lib″
#include < commctrl.h>
//…在初始化处加上…
initcommoncontrols
然后编译则大功告成!
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器