让VC6.0编译出来的程序支持XP样式或XP风格

时间:2023-12-30 17:40:20

(1)VC6.0编译出来的win32程序不支持winxp样式的原因:微软WINXP系统更新了Comctl32.dll(ver 6.0)这个“XP风格”的控件。为了保留传统的Windows界面风格,特地留下了Comctl32.dll v5.8。VC6的推出时间早于WinXP,因此VC6的程序默认是不能使用“xp风格”

(2)修改项目使其编译的程序有winxp样式的方法:使exe在资源区域的manifest[载货名单] 中注册Comctl32.dll 6.0.从而让windows自动以xp样式控件运行exe.

1>打开你的VC6 工程,找到资源试图(ResourceView),然后在视图中的树的根结点上点鼠标右键,选择菜单“插入(Insert)”。
  2>在弹出的“插入资源(Insert Resource)”对话框中选择“自定义Custom”,在新对话框(“New Custom Resource”)输入框中输入 24。 因为manifest的类型是24, 点击“OK”按钮。
  3>在资源视图的树上面选择24下方的条目“IDR_DEFAULT1”上点右键,选择“Properties”,将ID:修改为1.
  4>双击刚才修改的“1”条目,然后在右方的编辑器窗口中输入下面的代码:

(3)填写如下载货名单代码:

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