新建一个本文文件,把以下代码复制进去
name="XP style manifest"
processorArchitecture="x86"
version="1.0.0.0"
type="win32"/>
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="x86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
|
以任意名.manifest存盘并把他复制到程序编译目录,这里我存为XPStyle.manifest。
用本文文档方式打开资源文件(.rc),在结尾加上一行
编译即可。
1”代表资源ID,必须是“1”。“24”代表资源类型,我们对RT_ACCELERATOR、RT_BITMAP、RT_MENU、RT_STRING等资源都非常熟悉,而“24”实际上是RT_MANIFEST。 |
也可以如下操作:
在VC开发环境中添加资源,在“Insert Resource”对话框中,选择“Import”按钮,选择上述生成的文件,点击“Import”按钮,弹出“Costom Resource Type”对话框,在对话框的“Resource Type”中输入24。按“确定”,然后回到资源窗口,右键点击刚刚添加的自定义资源,选择“属性”,修改资源的ID,输入IDR_XP_STYLE=1即可。
还有第三种方法:
用文本工具将资源文件(Resource.rc)打开,添加以下代码到文件中:
/////////////////////////////////////////////////////////////////////////////
//
// 24
//
IDR_XP_STYLE 24 DISCARDABLE
BEGIN
0x3f3c, 0x6d78, 0x206c, 0x6576, 0x7372, 0x6f69, 0x3d6e, 0x3122, 0x302e,
0x2022, 0x6e65, 0x6f63, 0x6964, 0x676e, 0x223d, 0x5455, 0x2d46, 0x2238,
0x7320, 0x6174, 0x646e, 0x6c61, 0x6e6f, 0x3d65, 0x7922, 0x7365, 0x3f22,
0x0d3e, 0x3c0a, 0x7361, 0x6573, 0x626d, 0x796c, 0x7820, 0x6c6d, 0x736e,
0x223d, 0x7275, 0x3a6e, 0x6373, 0x6568, 0x616d, 0x2d73, 0x696d, 0x7263,
0x736f, 0x666f, 0x2d74, 0x6f63, 0x3a6d, 0x7361, 0x2e6d, 0x3176, 0x2022,
0x616d, 0x696e, 0x6566, 0x7473, 0x6556, 0x7372, 0x6f69, 0x3d6e, 0x3122,
0x302e, 0x3e22, 0x0a0d, 0x613c, 0x7373, 0x6d65, 0x6c62, 0x4979, 0x6564,
0x746e, 0x7469, 0x0d79, 0x200a, 0x6e20, 0x6d61, 0x3d65, 0x5822, 0x2050,
0x7473, 0x6c79, 0x2065, 0x616d, 0x696e, 0x6566, 0x7473, 0x0d22, 0x200a,
0x7020, 0x6f72, 0x6563, 0x7373, 0x726f, 0x7241, 0x6863, 0x7469, 0x6365,
0x7574, 0x6572, 0x223d, 0x3878, 0x2236, 0x0a0d, 0x2020, 0x6576, 0x7372,
0x6f69, 0x3d6e, 0x3122, 0x302e, 0x302e, 0x302e, 0x0d22, 0x200a, 0x7420,
0x7079, 0x3d65, 0x7722, 0x6e69, 0x3233, 0x2f22, 0x0d3e, 0x3c0a, 0x6564,
0x6570, 0x646e, 0x6e65, 0x7963, 0x0d3e, 0x200a, 0x3c20, 0x6564, 0x6570,
0x646e, 0x6e65, 0x4174, 0x7373, 0x6d65, 0x6c62, 0x3e79, 0x0a0d, 0x2020,
0x2020, 0x613c, 0x7373, 0x6d65, 0x6c62, 0x4979, 0x6564, 0x746e, 0x7469,
0x0d79, 0x200a, 0x2020, 0x2020, 0x7420, 0x7079, 0x3d65, 0x7722, 0x6e69,
0x3233, 0x0d22, 0x200a, 0x2020, 0x2020, 0x6e20, 0x6d61, 0x3d65, 0x4d22,
0x6369, 0x6f72, 0x6f73, 0x7466, 0x572e, 0x6e69, 0x6f64, 0x7377, 0x432e,
0x6d6f, 0x6f6d, 0x2d6e, 0x6f43, 0x746e, 0x6f72, 0x736c, 0x0d22, 0x200a,
0x2020, 0x2020, 0x7620, 0x7265, 0x6973, 0x6e6f, 0x223d, 0x2e36, 0x2e30,
0x2e30, 0x2230, 0x0a0d, 0x2020, 0x2020, 0x2020, 0x7270, 0x636f, 0x7365,
0x6f73, 0x4172, 0x6372, 0x6968, 0x6574, 0x7463, 0x7275, 0x3d65, 0x7822,
0x3638, 0x0d22, 0x200a, 0x2020, 0x2020, 0x7020, 0x6275, 0x696c, 0x4b63,
0x7965, 0x6f54, 0x656b, 0x3d6e, 0x3622, 0x3935, 0x6235, 0x3436, 0x3431,
0x6334, 0x6663, 0x6431, 0x2266, 0x0a0d, 0x2020, 0x2020, 0x2020, 0x616c,
0x676e, 0x6175, 0x6567, 0x223d, 0x222a, 0x0a0d, 0x2020, 0x2020, 0x3e2f,
0x0a0d, 0x2020, 0x2f3c, 0x6564, 0x6570, 0x646e, 0x6e65, 0x4174, 0x7373,
0x6d65, 0x6c62, 0x3e79, 0x0a0d, 0x2f3c, 0x6564, 0x6570, 0x646e, 0x6e65,
0x7963, 0x0d3e, 0x3c0a, 0x612f, 0x7373, 0x6d65, 0x6c62, 0x3e79, 0x0a0d,
END
然后回到开发环境的资源视图,会看到一个文件夹名为24下有一个字符串,就直接在属性中将该字符串修改为:
IDR_XP_STYLE=1即可