예제 #1
0
        //Enables Classic Theme and if specified Classic Taskbar.
        public static void MasterEnable(bool taskbar)
        {
            Process.Start("C:\\SCT\\EnableThemeScript.bat", "pre").WaitForExit();
            Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("SimpleClassicTheme");
            Registry.SetValue(@"HKEY_CURRENT_USER\SOFTWARE\1337SimpleClassicTheme", "Enabled", true.ToString());
            //SCTT
            if ((string)Configuration.GetItem("TaskbarType", "SiB+OS") == "SCTT")
            {
#if DEBUG
#else
                if (Assembly.GetExecutingAssembly().Location != "C:\\SCT\\SCT.exe")
                {
                    MessageBox.Show("This action requires SCT to be installed and SCT to be ran from the Start Menu");
                }
                else
#endif
                {
                    ClassicTaskbar.EnableSCTT();
                    Enable();
                }
            }
            //Windows 8.1
            else if (Environment.OSVersion.Version.Major != 10)
            {
                //Enable the theme
                Enable();

                //Make explorer apply theme
                Process.Start("cmd", "/c taskkill /im explorer.exe /f").WaitForExit();
                Process.Start("explorer.exe", @"C:\Windows\explorer.exe");
                Thread.Sleep((int)Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("1337ftw").CreateSubKey("SimpleClassicTheme").GetValue("TaskbarDelay", 5000));

                ClassicTaskbar.FixWin8_1();
            }
            //Windows 10 with taskbar
            else if (taskbar)
            {
                ClassicTaskbar.Enable();
                Enable();
            }
            //Just enable
            else
            {
                Enable();
            }
            Process.Start("C:\\SCT\\EnableThemeScript.bat", "post").WaitForExit();
        }
예제 #2
0
        //Enables Classic Theme and if specified Classic Taskbar.
        public static void MasterEnable(bool taskbar)
        {
            Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("SimpleClassicTheme");
            Registry.SetValue(@"HKEY_CURRENT_USER\SOFTWARE\SimpleClassicTheme", "Enabled", true.ToString());
            //Windows 8.1
            if (Environment.OSVersion.Version.Major != 10)
            {
                //Enable the theme
                Enable();

                //Make explorer apply theme
                Process.Start("cmd", "/c taskkill /im explorer.exe /f").WaitForExit();
                Process.Start("explorer.exe", @"C:\Windows\explorer.exe");
                Thread.Sleep((int)Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("SimpleClassicTheme").GetValue("TaskbarDelay", 5000));

                /*
                 * Remove taskbar blur
                 */

                //Get a handle to the taskbar
                IntPtr taskBarHandle = User32.FindWindowExW(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", "");
                //Create an ACCENTPOLICY instance which describe to disable any sort of transparency or blur
                User32.ACCENTPOLICY accentPolicy = new User32.ACCENTPOLICY {
                    nAccentState = 0
                };
                //Get the size of the ACCENTPOLICY instance
                int accentPolicySize = Marshal.SizeOf(accentPolicy);
                //Get the pointer to the ACCENTPOLICY instance
                IntPtr accentPolicyPtr = Marshal.AllocHGlobal(accentPolicySize);
                //Copy the struct to unmanaged memory so that Win32 can read it
                Marshal.StructureToPtr(accentPolicy, accentPolicyPtr, false);
                //Create a WINCOMPATTRDATA instance which sets the WindowCompositionAttribute (19) to the ACCENTPOLICY instance
                var winCompatData = new User32.WINCOMPATTRDATA
                {
                    nAttribute = 19,
                    ulDataSize = accentPolicySize,
                    pData      = accentPolicyPtr
                };
                //Tell Windows to apply the attribute
                User32.SetWindowCompositionAttribute(taskBarHandle, ref winCompatData);
                //Free the pointer to the ACCENTPOLICY instance
                Marshal.FreeHGlobal(accentPolicyPtr);

                /*
                 * Remove taskbar borders
                 */

                //Get the current taskbar WindowStyle
                IntPtr p = User32.GetWindowLongPtrW(taskBarHandle, -16);
                //Set the taskbar WindowStyle to the original plus an offset of 0x400000
                User32.SetWindowLongPtrW(taskBarHandle, -16, new IntPtr(p.ToInt64() + 0x400000));
                //Set the taskbar WindowStyle back to the original
                User32.SetWindowLongPtrW(taskBarHandle, -16, p);
            }
            //Windows 10 with taskbar
            else if (taskbar)
            {
                ClassicTaskbar.Enable();
                Enable();
            }
            //Just enable
            else
            {
                Enable();
            }
        }
예제 #3
0
        //Enables Classic Theme and if specified Classic Taskbar.
        public static void MasterEnable(bool taskbar, bool commandLineError = false)
        {
            Process.Start($"{Configuration.InstallPath}EnableThemeScript.bat", "pre").WaitForExit();
            Configuration.Enabled = true;
            if (!taskbar)
            {
                // No taskbar
                if (ExplorerPatcher.Enabled)
                {
                    ExplorerPatcher.ApplyConfiguration(true);
                }
                Enable();
            }
            else if (!File.Exists($"{Configuration.InstallPath}SCT.exe"))
            {
                if (!commandLineError)
                {
                    MessageBox.Show("You need to install Simple Classic Theme in order to enable it with Classic Taskbar enabled. Either disable Classic Taskbar from the options menu, or install SCT by pressing 'Run SCT on boot' in the main menu.", "Unsupported action");
                }
                else
                {
                    Console.WriteLine($"Enabling SCT with a taskbar requires SCT to be installed to \"{Configuration.InstallPath}SCT.exe\".");
                }
                Configuration.Enabled = false;
                return;
            }
            else if (Configuration.TaskbarType == TaskbarType.StartIsBackOpenShell)
            {
                if (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 3)
                {
                    // StartIsBack+ and Open-Shell
                    // Unsupported for now
                    if (!commandLineError)
                    {
                        MessageBox.Show("StartIsBack+ is still unsupported. Please select another taskbar method through the options menu or with the --set commandline option.", "Unsupported action");
                    }
                    else
                    {
                        Console.WriteLine("StartIsBack+ is still unsupported. Please select another taskbar method.");
                    }
                    Configuration.Enabled = false;
                }
                else if (Environment.OSVersion.Version.Major == 10 && Environment.OSVersion.Version.Build < 22000)
                {
                    // StartIsBack++ and Open-Shell
                    if (ExplorerPatcher.Enabled)
                    {
                        ExplorerPatcher.ApplyConfiguration();
                    }
                    ClassicTaskbar.Enable();
                    Thread.Sleep(Configuration.TaskbarDelay);
                    Enable();
                }
                else if (Environment.OSVersion.Version.Major == 10 && Environment.OSVersion.Version.Build >= 22000)
                {
                    // StartAllBack and Open-Shell
                    // Unsupported for now
                    if (!commandLineError)
                    {
                        MessageBox.Show("StartAllBack is still unsupported. Please select another taskbar method through the options menu or with the --set commandline option.", "Unsupported action");
                    }
                    else
                    {
                        Console.WriteLine("StartAllBack is still unsupported. Please select another taskbar method.");
                    }
                    Configuration.Enabled = false;
                }
                else
                {
                    // Unsupported operating system
                    if (!commandLineError)
                    {
                        MessageBox.Show("There's no version of StartIsBack for your version of Windows. Please select another taskbar method through the options menu or with the --set commandline option.", "Unsupported action");
                    }
                    else
                    {
                        Console.WriteLine("There's no version of StartIsBack for your version of Windows. Please select another taskbar method.");
                    }
                    Configuration.Enabled = false;
                }
            }
            else if (Configuration.TaskbarType == TaskbarType.SimpleClassicThemeTaskbar)
            {
                // Simple Classic Theme Taskbar
                Enable();
                if (ExplorerPatcher.Enabled)
                {
                    ExplorerPatcher.ApplyConfiguration();
                }
                Process.Start("cmd", "/c taskkill /im explorer.exe /f").WaitForExit();
                Process.Start("explorer.exe", @"C:\Windows\explorer.exe");
                ClassicTaskbar.EnableSCTT();
            }
            else if (Configuration.TaskbarType == TaskbarType.Windows81Vanilla)
            {
                // Windows 8.1 Vanilla taskbar with post-load patches
                Enable();

                if (ExplorerPatcher.Enabled)
                {
                    ExplorerPatcher.ApplyConfiguration();
                }
                Process.Start("cmd", "/c taskkill /im explorer.exe /f").WaitForExit();
                Process.Start("explorer.exe", @"C:\Windows\explorer.exe");
                Thread.Sleep(Configuration.TaskbarDelay);
                ClassicTaskbar.FixWin8_1();
            }
            else if (Configuration.TaskbarType == TaskbarType.RetroBar)
            {
                // RetroBar
                Enable();
                if (ExplorerPatcher.Enabled)
                {
                    ExplorerPatcher.ApplyConfiguration();
                }
                Process.Start("cmd", "/c taskkill /im explorer.exe /f").WaitForExit();
                Process.Start("explorer.exe", @"C:\Windows\explorer.exe");
                Process.Start($"{Configuration.InstallPath}RetroBar\\RetroBar.exe");
            }
            else if (Configuration.TaskbarType == TaskbarType.ExplorerPatcher)
            {
                // Windows 11 Vanilla taskbar with ExplorerPatcher
                Enable();
                if (ExplorerPatcher.Enabled)
                {
                    ExplorerPatcher.ApplyConfiguration(true);
                }
            }
            Process.Start($"{Configuration.InstallPath}EnableThemeScript.bat", "post").WaitForExit();
        }