Exemple #1
0
        public Taskbar(IntPtr hwnd)
        {
            HWND         = hwnd;
            Monitor      = Externals.MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
            AccentPolicy = new AccentPolicy();


            FindMaximizedWindowsHere();
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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;
        }
Exemple #4
0
        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);
            }
        }