是否有GetThemeColor /视觉样式API有效的参数组合列表 [英] Is there a list of valid parameter combinations for GetThemeColor / Visual Styles API

查看:521
本文介绍了是否有GetThemeColor /视觉样式API有效的参数组合列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图检索任务栏和/或我的应用程序主窗口的背景和文本颜色。事实证明,Windows 7的不返回正确的色彩。如果我即切换到一个粉红色主题,Windows 7中仍然返回窗口的标题,虽然那不是真正的淡蓝色。发生这种情况使用

I am trying to retrieve the background and text color of the taskbar and/or my applications main window. It turned out, that Windows 7 does not return the correct colors. If i i.e. switch to a pink theme, Windows 7 still returns light blue for window caption although thats not true. This happens using

GetSysColor(COLOR_ACTIVECAPTION);

,以及使用
    HTHEME hTheme = OpenThemeData(HWND,L窗口);

as well as using HTHEME hTheme = OpenThemeData(hwnd, L"WINDOW");

HRESULT result = GetThemeColor(      
                hTheme,
                WP_CAPTION, 
                CS_ACTIVE, 
                TMT_FILLCOLORHINT, 
                &color);

此外,我发现自己想的参数不同的组合,找出标题文本的颜色。我知道微软的网页

Moreover i find myself trying various combinations of parameters to find out the color of the caption text. I know microsofts pages

属性标识符并的零件和国家

但这些数百参数的最组合是无效的。是否有可使用的组合的任何列表和/或说明

but most combination of these hundreds of parameters are invalid. Is there any list and/or description which combinations can be used?

即。

 GetThemeColor(      
                    hTheme,
                    WP_CAPTION, // BP_PUSHBUTTON,
                    CS_ACTIVE, 
                    TMT_CAPTIONTEXT,
                    &color);

返回找不到元素。

returns "Element not found".

推荐答案

据我的XP主题的知识,一个.msstyles文件仅仅是一个具有图像和性质(颜色,大小,字体等)的部分定义集合,所有的任意定义。该的Uxtheme API只返回无论是在这个文件,和属性的某种组合的presence依赖于题材作家,基本上(这就是为什么你应该总是退回到经典 GetSysColor GetSystemMetrics的 SystemParametersInfo 如果主题API未能返回无论你正在寻找。

According to my knowledge of XP themes, an .msstyles file is just a collection of parts definitions that have images and properties (colors, sizes, fonts, etc), all arbitrarily defined. The UxTheme API just returns whatever is in this file, and the presence of a certain combination of properties depends on the theme author, basically (which is why you should always fall back to "classic" GetSysColor, GetSystemMetrics or SystemParametersInfo if the theme API fails to return whatever you are looking for.

不过,你提到了粉红色的主题为在这里,所以我假定你说话的Aero玻璃主题。 Aero主题颜色由DWM处理,尚未从经典或API的Uxtheme颜色分开。为了找回Aero的窗口颜色,你必须使用 DwmGetColorizationColor ,这将在0xAARRGGBB格式返回它(而不是一个 COLORREF 这是0x00BBGGRR,所以你需要将两种格式之间进行转换)。为了先找如果启用DWM成分(又名Aero玻璃),您必须调用 DwmIsCompositionEnabled

However, you mention a "pink theme" here, so I assume you are speaking of an Aero Glass theme. Aero theme colors are handled by the DWM and are yet separate from the classic or UxTheme API colors. In order to retrieve the Aero window color, you must use DwmGetColorizationColor, which will return it in 0xAARRGGBB format (as opposed to a COLORREF which is 0x00BBGGRR, so you will need to translate between the two formats). In order to first find if DWM composition (aka "Aero Glass") is enabled, you must call DwmIsCompositionEnabled.

这篇关于是否有GetThemeColor /视觉样式API有效的参数组合列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆