none
对一段预编译代码的不理解 RRS feed

  • 问题

  •       使用VS 2005新建一个单文档工程,其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
    据网上的一种说法,该段代码具有打开xp界面风格的作用,具体见:
    VC6风格转XP风格界面的两种方法

      我比较奇怪的是为何这段代码要指定unicode字符集下才起作用?去掉#ifdef _UNICODE 会有副作用吗?


    前无古人,后无来者

    2012年6月3日 6:32

答案

  • 一般的,_UNICODE和UNICODE都会同时定义的,要么都定义,要么一个也不定义。


    Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.

    • 已标记为答案 Helen Zhao 2012年6月11日 3:17
    2012年6月4日 6:03
    版主

全部回复

  • 一般的,_UNICODE和UNICODE都会同时定义的,要么都定义,要么一个也不定义。


    Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.

    • 已标记为答案 Helen Zhao 2012年6月11日 3:17
    2012年6月4日 6:03
    版主
  • 一般的,_UNICODE和UNICODE都会同时定义的,要么都定义,要么一个也不定义。


    Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.

               大侠,我问的是为何这段代码不支持多字节字符集?

    前无古人,后无来者

    2012年6月4日 7:11
  • http://blog.csdn.net/kakaxisama/article/details/5221421

    参考这篇blog,希望对您有帮助~


    Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.

    • 已建议为答案 Helen Zhao 2012年6月11日 3:17
    2012年6月4日 13:28
    版主
  • http://blog.csdn.net/kakaxisama/article/details/5221421

    参考这篇blog,希望对您有帮助~


    Visual C++ enthusiast, like network programming and driver development. At present is being engaged in the WinCE/Windows Mobile platform embedded development.

          官方的文档说明是comctl32.dll version6只支持unicode,非unicode下使用会出现异常
    非unicode下使用一般也没啥问题,可能是在某种情况下才会异常。

    前无古人,后无来者

    2012年6月5日 10:49
  • 在多字符集的配置下,使用这段代码会出现异常,我想在多字符集配置下修改控件的风格,使用以上代码Edit Browse控件报错
    2013年11月14日 8:59