[英]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谢谢
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.