简体   繁体   English

在VS2008中关闭XP Theme编译MFC App

[英]Turn off XP Theme in VS2008 compiled MFC App

We've just recently switched our C++ MFC Application from VS2005 to VS2008.我们最近刚刚将 C++ MFC 应用程序从 VS2005 切换到 VS2008。 Unfortunately in doing so our UI has appearance problems, with things like group boxes appearing blue rather than black, properties dialogs having a white background etc. I presume that in VS2008, MFC has been changed to respect the OS theme (in my case XP default theme).不幸的是,这样做我们的 UI 存在外观问题,例如组框显示为蓝色而不是黑色,属性对话框具有白色背景等。我认为在 VS2008 中,MFC 已更改为尊重操作系统主题(在我的情况下为 XP 默认主题)。 Unfortunately, changing all our controls and our custom toolbars to make the app look decent again is going to require a lot of work.不幸的是,更改我们所有的控件和自定义工具栏以使应用程序再次看起来不错将需要大量工作。

So, does anyone know if there is a way in code to put the app back in VS2005 mode?那么,有谁知道代码中是否有办法将应用程序恢复到 VS2005 模式? I found the following code我找到了以下代码

typedef void (WINAPI *tSetThemeAppProperties)(  DWORD );

tSetThemeAppProperties pSetThemeAppProperties=0;
HINSTANCE  handle  = ::LoadLibrary("UxTheme.dll");

if (handle) 
    pSetThemeAppProperties = (tSetThemeAppProperties) ::GetProcAddress(handle,"SetThemeAppProperties"); 


if ( pSetThemeAppProperties)
{
    // call function
    pSetThemeAppProperties(0/*dwFlags*/);
}
::FreeLibrary(handle);

Which does stop the XP theme being picked up, but turns off ALL themes and leaves the application looking more dated than it did in VS2005.这确实会阻止 XP 主题被拾取,但会关闭所有主题并使应用程序看起来比在 VS2005 中更过时。

thanks谢谢

It may be that VS2008 is including a Manifest file in the project that loads the version 6.0 comctl32.dll rather than the 5.82 comctl32.dll... both ship with Windows XP and newer.可能是 VS2008 在项目中包含一个Manifest文件,该文件加载版本 6.0 comctl32.dll 而不是 5.82 comctl32.dll...都附带 ZAEA2063488erCE3AAB4

Under "Properties->Configuration Properties->Linker->Manifest File", set the "Generate Manifest" option to "No".在“属性->配置属性->链接器->清单文件”下,将“生成清单”选项设置为“否”。

Then add your own manifest file if you like, and set it under "Properties->Configuration Properties->Manifest Tool->Input and Output", "Input Resource Manifest".然后根据需要添加自己的清单文件,并在“属性->配置属性->清单工具->输入和输出”、“输入资源清单”下进行设置。

Just make sure that if you add your own manifest file that it doesn't contain the reference to commctl32 v6.只要确保如果您添加自己的清单文件,它不包含对 commctl32 v6 的引用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在使用VS2015编译的应用程序中加载VS2008的调试可再发行组件失败 - Loading debug redistributables of VS2008 in app which got compiled with VS2015 fails 在Windows 7上构建的C ++应用程序(使用VS2010 IDE和VS2008工具集)在Windows 7上运行,但在Win XP上不运行 - C++ app built on Windows 7 (using VS2010 IDE and VS2008 toolset) runs on Windows 7, but not on Win XP VS2008 MFC Feature Pack-菜单(CMFCMenuBar)状态未保存 - VS2008 MFC Feature pack - menu (CMFCMenuBar) status is not saved VS2008编译的C / C ++中的struct复制问题 - struct copying issue in C/C++ compiled with VS2008 vs2008的sproxy吗? - sproxy for vs2008? 在VS2008中编译的代码不在VS2013中编译,const重载 - Code compiled in VS2008 doesn't in VS2013, const overloading boost::multi_index_container 使用 vs2008 编译但不使用 vs2019 - boost::multi_index_container compiled with vs2008 but not with vs2019 调用LoadFrame()MFC,RIBBON,VS2008,C ++时断言失败 - Assertion failure on calling LoadFrame() MFC, RIBBON, VS2008, C++ 检测何时将剪切的数据粘贴到MFC COleDataSource VS2008中 - Detect when cut-ed data is being pasted in MFC COleDataSource VS2008 在Windows CE模拟器中部署的vs2008中,brekpoint并未实现MFC C ++代码的和平 - brekpoint is not hitting in peace of MFC C++ code in vs2008 deployed in Windows CE emulator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM