public Taskbar(IntPtr hwnd) { HWND = hwnd; Monitor = Externals.MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); AccentPolicy = new AccentPolicy(); FindMaximizedWindowsHere(); }
public static void ApplyStyles(Taskbar taskbar) { int sizeOfPolicy = Marshal.SizeOf(taskbar.AccentPolicy); IntPtr policyPtr = Marshal.AllocHGlobal(sizeOfPolicy); Marshal.StructureToPtr(taskbar.AccentPolicy, policyPtr, false); WinCompatTrData data = new WinCompatTrData(WindowCompositionAttribute.WCA_ACCENT_POLICY, policyPtr, sizeOfPolicy); Externals.SetWindowCompositionAttribute(taskbar.HWND, ref data); Marshal.FreeHGlobal(policyPtr); }
public void FindMaximizedWindowsHere() { bool isInThisScreen = false; IntPtr thisAppMonitor; foreach (IntPtr hwnd in Globals.MaximizedWindows) { thisAppMonitor = Externals.MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); if (Monitor == thisAppMonitor) { isInThisScreen = true; } } HasMaximizedWindow = isInThisScreen; return; }
void FindTaskBar() { Taskbars.Bars = new List <Taskbar>(); Taskbars.Bars.Add(new Taskbar(Externals.FindWindow("Shell_TrayWnd", null))); IntPtr otherBars = IntPtr.Zero; while (true) { otherBars = Externals.FindWindowEx(IntPtr.Zero, otherBars, "Shell_SecondaryTrayWnd", ""); if (otherBars == IntPtr.Zero) { break; } else { Taskbars.Bars.Add(new Taskbar(otherBars)); } } Taskbars.UpdateAllSettings(); foreach (Taskbar taskbar in Taskbars.Bars) { Taskbars.ApplyStyles(taskbar); } }