From time to time,
Long Zheng asks me to augment
MetroTwit with some obscure low-level Windows feature. Given that’s where I like to dwell, it’s a good fit for me. My latest task was to implement smarts into the MetroTwit header pane that picked up the user’s current Aero Glass color.
DwmGetColorizationColor immediately popped into mind and I was done an hour later. Of course, things weren’t working very well…
According to MSDN, DwmGetColorizationColor returns a color “used for Desktop Window Manager glass composition” and a boolean that simply indicates whether or not transparency is involved. The notable keyword here is
composition. In the simplest scenario, a user uses a non-transparent color. This value simply gets passed to your application and everything Just Works™. In the real world, however (where transparency is turned on), things get a little trickier. The transparency toggle dutifully instructs the Desktop Window Manager to do all kinds of glass-like math-heavy nerd stuff to the base color. In this scenario, the returned color value is less useful.