MFC项目改为多字节字符集界面风格变为win98风格的问题

在项目->属性->配置属性中,将字符集改为多字节字符集,则界面风格变成了win98风格
MFC项目改为多字节字符集界面风格变为win98风格的问题_第1张图片
解决办法,在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

他们在UNICODE模式下生效,添加对公共控件的依赖。在多字节模式下就会失效,因此在stdafx.h最后添加

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

点击生成,清理解决方案,之后重新生成程序
MFC项目改为多字节字符集界面风格变为win98风格的问题_第2张图片

你可能感兴趣的:(mfc/win32,mfc,c++)