/// <summary> /// Helper method for an easy DWM check /// </summary> /// <returns>bool true if DWM is available AND active</returns> public static bool isDWMEnabled() { if (Environment.OSVersion.Version.Major >= 6) { bool dwmEnabled; DWM.DwmIsCompositionEnabled(out dwmEnabled); return(dwmEnabled); } return(false); }
/// <summary> /// Helper method to get the window size for DWM Windows /// </summary> /// <param name="rectangle">out Rectangle</param> /// <returns>bool true if it worked</returns> public static bool GetExtendedFrameBounds(IntPtr hWnd, out Rectangle rectangle) { RECT rect; int result = DWM.DwmGetWindowAttribute(hWnd, (int)DWMWINDOWATTRIBUTE.DWMWA_EXTENDED_FRAME_BOUNDS, out rect, Marshal.SizeOf(typeof(RECT))); if (result >= 0) { rectangle = rect.ToRectangle(); return(true); } rectangle = Rectangle.Empty; return(false); }
/// <summary> /// Helper method for an easy DWM check /// </summary> /// <returns>bool true if DWM is available AND active</returns> public static bool isDWMEnabled() { // According to: http://technet.microsoft.com/en-us/subscriptions/aa969538%28v=vs.85%29.aspx // And: http://msdn.microsoft.com/en-us/library/windows/desktop/aa969510%28v=vs.85%29.aspx // DMW is always enabled on Windows 8! So return true and save a check! ;-) if (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 2) { return(true); } if (Environment.OSVersion.Version.Major >= 6) { bool dwmEnabled; DWM.DwmIsCompositionEnabled(out dwmEnabled); return(dwmEnabled); } return(false); }
public static void DisableComposition() { DWM.DwmEnableComposition(DWM.DWM_EC_DISABLECOMPOSITION); }