4

I have an WPF application which I wish it can enable blur when I set the background translucent. Currently I'm using Win32 API DwmIsCompositionEnabled to detect whether composition is enabled. This API works on OS which support Aero glass effect. But an user told me that he uses Windows 7 Home Basic, which support composition and is enabled, but do NOT support Aero glass effect. So DwmIsCompositionEnabled returns true but Aero is not supported. Another case is Windows 8, which support composition but no Aero glass effect. How can I easily detect whether Aero glass effect is turned on? Or I can only manually detect which Windows version and edition user is using?

(DwmIsCompositionEnabled can detect whether composition is enabled but can't tell us whether Aero glass effect is enabled.)

K.F.Storm
  • 41
  • 1
  • 2
  • Fairly sure you'll want DwmGetWindowAttribute(), DWMWA_NCRENDERING_ENABLED attribute – Hans Passant Aug 22 '13 at 14:32
  • @Hans Passant, thanks! This API uses a window handle to get this window's info. Can I get the system level info? – K.F.Storm Aug 23 '13 at 06:45
  • 2
    Finally, I figured it out! Just combine DwmIsCompositionEnabled and DwmGetColorizationColor! If DwmIsCompositionEnabled returns true and DwmGetColorizationColor returns that opacity is false, then Aero glass effect is on, otherwise off. This supports all editions of Vista, 7, 8 and maybe future versions. Remember to check if OS major version is 6 or above. – K.F.Storm Aug 24 '13 at 09:14
  • 1
    Note that opacity only indicates if transparency of Aero Glass is enabled. It doesn't differentiate between opaque Aero Glass (Vista/Win7) and opaque color rectangle (Win8/8.1/10). – raymai97 Feb 02 '18 at 13:07

0 Answers0