//TaskBar public static bool SetTaskbarVisibilityIfIntersect(bool visible, Rectangle rect) { bool result = false; IntPtr taskbarHandle = FindWindow("Shell_TrayWnd", null); if (taskbarHandle != IntPtr.Zero) { Rectangle taskbarRect = GetWindowRect(taskbarHandle); if (rect.IntersectsWith(taskbarRect)) { ShowWindow(taskbarHandle, visible ? (int)WindowShowStyle.Show : (int)WindowShowStyle.Hide); result = true; } if (OsExtend.IsWindowsVista() || OsExtend.IsWindows7()) { IntPtr startHandle = FindWindowEx(IntPtr.Zero, IntPtr.Zero, (IntPtr)0xC017, null); if (startHandle != IntPtr.Zero) { Rectangle startRect = GetWindowRect(startHandle); if (rect.IntersectsWith(startRect)) { ShowWindow(startHandle, visible ? (int)WindowShowStyle.Show : (int)WindowShowStyle.Hide); result = true; } } } } return(result); }
public static Rectangle GetWindowRectangle(IntPtr handle) { Rectangle rect = Rectangle.Empty; if (Native.IsDWMEnabled() && Native.GetExtendedFrameBounds(handle, out Rectangle tempRect)) { rect = tempRect; } if (rect.IsEmpty) { rect = Native.GetWindowRect(handle); } if (!OsExtend.IsWindows10OrGreater() && Native.IsZoomed(handle)) { rect = Native.MaximizedWindowFix(handle, rect); } return(rect); }
//TaskBar public static bool SetTaskbarVisibility(bool visible) { IntPtr taskbarHandle = FindWindow("Shell_TrayWnd", null); if (taskbarHandle != IntPtr.Zero) { ShowWindow(taskbarHandle, visible ? (int)WindowShowStyle.Show : (int)WindowShowStyle.Hide); if (OsExtend.IsWindowsVista() || OsExtend.IsWindows7()) { IntPtr startHandle = FindWindowEx(IntPtr.Zero, IntPtr.Zero, (IntPtr)0xC017, null); if (startHandle != IntPtr.Zero) { ShowWindow(startHandle, visible ? (int)WindowShowStyle.Show : (int)WindowShowStyle.Hide); } } return(true); } return(false); }
public static bool IsDWMEnabled() { return(OsExtend.IsWindowsVistaOrGreater() && DwmIsCompositionEnabled()); }