【MFC】使用不同字符集显示不同外观的界面

今天遇到一个问题是程序默认为 Unicode 编码方式,这样需要定义成CString  a = L“”。

网上处理这个的方法是 解决方案文件属性->配置属性->常规->字符集 ,选择“使用多字节字符集”

但这样就出现了界面显示风格和默认设置的不一致

解决办法是 

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

你可能感兴趣的:(【MFC】使用不同字符集显示不同外观的界面)