正文

VS2008 界面 Unicode MultiByte2010-08-16 20:35:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/yuqiexing/51665.html

分享到:

1、 使用unicode后,编译的窗口风格是XP的风格。而如果用多字节(Multibyte)编译,则窗口的风格是老式的,如Win2000系统那种风格。原因在于stdafx.h中的设置:

 

         其实只需要将:

 #ifdef _UNICODE
#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
#endif

 

改为:

 #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

参考:

http://topic.csdn.net/u/20100618/09/7e677d7e-a26f-45d0-bceb-a4ad512fb6bf.html

2、使用Unicode后,exe无法调用非Unicode的MFC扩展库中的对话框创建。与AFX_MANAGE_STATE无关

 

3、关于xp和win7下的exe 如何快速使用带有风格的对话框:

 

    参考:

                 http://blog.csdn.net/xilyu/archive/2008/04/27/2335625.aspx 

                 http://www.vckbase.com/document/viewdoc/?id=596

 

     在VS2008下最好不要手工去rc文件中添加,直接选择在“Properties”-"Manifest Tools"-"Input and Output"-"additional manifest files"中添加即可。exe其调用的MFC扩展库中的对话框也会采用该风格。

 

     实际上相当于类似于1的问题,即只需要在stdafx.h中加入:(VS2008下测试通过)

#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")

 

4、如何在exe不使用manifest,dll使用manifest:

    除了3的步骤外,还需要多一步骤: 

 添加预编译开关:ISOLATION_AWARE_ENABLED
就是 Project-> Setting-> Category=General,   Preprocesser   definitions里加ISOLATION_AWARE_ENABLED声明。

 

阅读(3888) | 评论(1)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

loading...
您需要登录后才能评论,请 登录 或者 注册