{"id":179,"date":"2011-03-21T20:21:27","date_gmt":"2011-03-21T09:21:27","guid":{"rendered":"http:\/\/blog.quppa.net\/2011\/03\/21\/wm_dwmcolorizationcolorchanged-doesnt-give-the-aero-glass-base-colour\/"},"modified":"2011-03-21T20:21:27","modified_gmt":"2011-03-21T09:21:27","slug":"wm_dwmcolorizationcolorchanged-doesnt-give-the-aero-glass-base-colour","status":"publish","type":"post","link":"https:\/\/www.quppa.net\/blog\/2011\/03\/21\/wm_dwmcolorizationcolorchanged-doesnt-give-the-aero-glass-base-colour\/","title":{"rendered":"WM_DWMCOLORIZATIONCOLORCHANGED doesn\u2019t give the Aero Glass base colour"},"content":{"rendered":"<p>From <a title=\"MSDN: WM_DWMCOLORIZATIONCOLORCHANGED Message\" href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/dd388198(v=vs.85).aspx\">MSDN<\/a>:<\/p>\n<blockquote>\n<p><strong>WM_DWMCOLORIZATIONCOLORCHANGED Message<\/strong><\/p>\n<p>Sent to all top-level windows when the colorization color has changed.<\/p>\n<p><strong>Parameters<\/strong>       <br \/><em>wParam:<\/em> Specifies the new colorization color. The color format is 0xAARRGGBB.       <br \/><em>lParam: <\/em>Specifies whether the new color is blended with opacity.<\/p>\n<\/blockquote>\n<p>We receive this message when the Aero Glass colour changes. Unfortunately, the value contained in wParam is not the \u2018base colour\u2019, as it is in fact the result of the <a title=\"MSDN: DwmGetColorizationColor function\" href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/aa969513(v=vs.85).aspx\">DwmGetColorizationColor function<\/a>. As Rafael Rivera <a title=\"WithinWindows: Retrieving Aero Glass base color for opaque surface rendering\" href=\"http:\/\/www.withinwindows.com\/2010\/07\/01\/retrieving-aero-glass-base-color-for-opaque-surface-rendering\/\">noted last year<\/a>, when glass transparency is enabled, the value returned by this function is quite different to the base colour:<\/p>\n<p><a title=\"WithinWindows: Retrieving Aero Glass base color for opaque surface rendering\" href=\"http:\/\/www.withinwindows.com\/2010\/07\/01\/retrieving-aero-glass-base-color-for-opaque-surface-rendering\/\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px\" title=\"colorization\" border=\"0\" alt=\"colorization\" src=\"https:\/\/www.quppa.net\/blog\/wp-content\/uploads\/colorization.png\" width=\"504\" height=\"216\" \/><\/a><\/p>\n<p>As such, we shouldn\u2019t rely on the contents of wParam (or on the DwmGetColorizationColor function in general).<\/p>\n<p>The easiest method to find the actual base colour is to retrieve the ColorizationColor DWORD from HKCUSoftwareMicrosoftWindowsDWM. This, however, is undocumented, and could potentially change in a future version of Windows (it is correct in NT 6.0 and 6.1):<\/p>\n<pre class=\"lang:c# decode:true \">RegistryKey colourKey = Registry.CurrentUser.CreateSubKey(@&quot;SoftwareMicrosoftWindowsDWM&quot;);\nuint colour = (uint)(int)colourKey.GetValue(&quot;ColorizationColor&quot;);<\/pre>\n<p>(We can\u2019t cast directly to uint despite it being a REG_DWORD, hence the first cast to int\u2026)<\/p>\n<p>For those who feel more adventurous, Rafael went to the trouble of finding a function in dwmapi.dll which returns the base colour (amongst other things). He describes it <a title=\"WithinWindows: Retrieving Aero Glass base color for opaque surface rendering\" href=\"http:\/\/www.withinwindows.com\/2010\/07\/01\/retrieving-aero-glass-base-color-for-opaque-surface-rendering\/\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>From MSDN: WM_DWMCOLORIZATIONCOLORCHANGED Message Sent to all top-level windows when the colorization color has changed. Parameters wParam: Specifies the new colorization color. The color format is 0xAARRGGBB. lParam: Specifies whether the new color is blended with opacity. We receive this message when the Aero Glass colour changes. Unfortunately, the value contained in wParam is not &hellip; <a href=\"https:\/\/www.quppa.net\/blog\/2011\/03\/21\/wm_dwmcolorizationcolorchanged-doesnt-give-the-aero-glass-base-colour\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;WM_DWMCOLORIZATIONCOLORCHANGED doesn\u2019t give the Aero Glass base colour&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[11,12,34,50,51,170],"class_list":["post-179","post","type-post","status-publish","format-standard","hentry","category-programming","tag-aero","tag-aero-glass","tag-colour","tag-dwm","tag-dwmapi","tag-win32"],"_links":{"self":[{"href":"https:\/\/www.quppa.net\/blog\/wp-json\/wp\/v2\/posts\/179","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.quppa.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quppa.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quppa.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quppa.net\/blog\/wp-json\/wp\/v2\/comments?post=179"}],"version-history":[{"count":0,"href":"https:\/\/www.quppa.net\/blog\/wp-json\/wp\/v2\/posts\/179\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.quppa.net\/blog\/wp-json\/wp\/v2\/media?parent=179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quppa.net\/blog\/wp-json\/wp\/v2\/categories?post=179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quppa.net\/blog\/wp-json\/wp\/v2\/tags?post=179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}