关于manifest将VC6.0转入XP风格

关于manifest将VC6.0转为XP风格
首先将以下文本保存为XpStyle.mainfest(后经实践,文件名和后缀是什么都无所谓)

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

新建vc++工程,在资源选项卡(resourceview)中右键import->所有文件->找到刚才的 XpStyle.mainfest导入,资源类型名为24(必须是24),ok,然后修改IDR_241为1(必须是1)。


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/glldc/archive/2008/07/14/2648945.aspx
我的代码以前是用VC6.0做的,后来转到VS2005上开发,风格却一直是传统风格,最后用上述方法转为XP风格。这个方法估计不少人都实现过。
我的问题是有没有第二种实现方法能达到这种效果,毕竟在文件夹下几个东西也是麻烦的
------解决方案--------------------
直接把xxxx.mainfest保存为文件,把xxxx改成你程序名,把xxxx.mainfest放在你程序同一目录就可以了
------解决方案--------------------
在stdafx.h的最后面加上下面的几行代码即可:

//xp样式支持
#if defined _M_IX86
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif


------解决方案--------------------
对于VC6的项目升级到VS2005环境下是需要添加
hurryboylqs(我想我可以) 
说的那段代码才行, 如果是直接用VS2005新建的项目IDE会自动在stdafx.h中添加这些代码,不需要自己加了。 而且VS2005会自动生成.mainfest文件,所有也不需要我们添加了。

以上说的事EXE文件的方法,对于DLL及ActiveX会有点不同。
---------
找到刚才的 XpStyle.mainfest导入,资源类型名为24(必须是24),ok,然后修改IDR_241为1(必须是1)。
-------------
对于DLL  IDR_241IDR_241为2为2, 对于ActiveX IDR_241IDR_241为2为3

当然如果在VS2005下面编译的项目也不需要我们关心这些了。
但对于DLL和ActiveX 项目,除了上面说的要在stdafx.h的最后面加代码外还需要在
#if _MSC_VER > 1000前面加上
#define ISOLATION_AWARE_ENABLED     1
才有效果

以上是我开发中的一些总结,如有不对的地方请指正!