private void comboBoxSysVer_SelectionChangeCommitted(object sender, EventArgs e) { string param = MenuControl.GetInjectParamFromIndex(comboBoxSysVer.SelectedIndex); if (param != null) { textBoxClassName.Text = param; } }
private void buttonApply_Click(object sender, EventArgs e) { XML_Save(currentFile); MenuControl.Menu98_ExitHost(); MenuControl.Menu98_Inject(textBoxClassName.Text); if (Installer.ExplorerImmersiveMenuRemoved() != checkBoxNoExplorerImmersiveMenu.Checked) { Installer.ExplorerImmersiveMenuUsing(!checkBoxNoExplorerImmersiveMenu.Checked); } }
private void buttonDetect_Click(object sender, EventArgs e) { if (MenuControl.isMenu98ModuleLoaded()) { labelStatus.Text = "Status: Loaded"; } else { labelStatus.Text = "Status: Not loaded"; } }
private void buttonStartNow_Click(object sender, EventArgs e) { if (MenuControl.isMenu98ModuleLoaded()) { labelStatus.Text = "Status: Loaded"; } else { MenuControl.Menu98_Inject(textBoxClassName.Text); buttonDetect_Click(sender, e); } }
private static void InstallTD_OnRadioButtonSelected(TaskDialog sender, object UserData, int ID) { string startParam = MenuControl.GetInjectParamFromIndex(sender.SelectedRadioButton); if (startParam == null) { sender.ExpandedInformation = "No startup"; } else { sender.ExpandedInformation = "Startup command: rundll32.exe " + Installer.installedTMTDll + ", Inject " + startParam; } }
private void FormMain_Load(object sender, EventArgs e) { this.Icon = IconManager.GetIcon("shell32.dll", 39, true); if (!System.IO.File.Exists(Installer.GetMenu98Path())) { Installer.ShowInstaller(this); } if (WinVer.IsWin10OrGreater()) { Win10Style.EnableBlur(this.Handle); } else { checkBoxNoExplorerImmersiveMenu.Enabled = false; checkBoxEnableImmersiveMenu.Enabled = false; checkBoxShowIcon.Enabled = false; checkBoxHideToggleOption.Enabled = false; } if (WinVer.IsVistaOrGreater()) { //DPI.SetCurrentProcessDPIAware(); Win7Style.EnableAero(this.Handle, panelExtended.Height, panelMain.Bottom, 0, 0); toolStrip.Renderer = new ToolStripNonClientRender(); } else { toolStrip.Renderer = new ToolStripNonClientRender(SystemColors.Control); toolStrip.Location = new Point(toolStrip.Location.X, toolStrip.Location.Y - 1); this.FormBorderStyle = FormBorderStyle.FixedSingle; this.ControlBox = true; this.Height -= panelMain.Location.Y; this.panelMain.Location = new Point(panelMain.Location.X, 0); this.Text = labelCaption.Text; } panelFrameB.Visible = false; panelFrameT.Visible = false; panelFrameR.Visible = false; panelFrameL.Visible = false; pictureBoxAppIcon.BackgroundImage = this.Icon.ToBitmap(); contextMenuStrip.Renderer = new ToolStripNonClientRender(); comboBoxStyle.SelectedIndex = 0; FormUtils.ShowShield(buttonUpdateStartupCommand.Handle, true); FormUtils.ShowShield(buttonRemoveStartUp.Handle, true); for (int i = 0; i <= MenuControl.OSList.Length; i++) { comboBoxSysVer.Items.Add(MenuControl.GetOSFromIndex(i)); } comboBoxSysVer.SelectedIndex = MenuControl.Os2ListIndex(WinVer.SystemVersion); checkBoxNoExplorerImmersiveMenu.Checked = Installer.ExplorerImmersiveMenuRemoved(); if (System.IO.File.Exists(Installer.GetConfigPath())) { XML_Load(Installer.GetConfigPath()); } else { switch (Installer.ShowSelectConfigFileBox(this)) { case DialogResult.Yes: Installer.DeployDefaultConfigFile(); XML_Load(Installer.GetConfigPath()); break; case DialogResult.No: if (!OpenConfigUsingDialog()) { this.Close(); } break; case DialogResult.Cancel: this.Close(); break; } } }
private void buttonReleadDLL_Click(object sender, EventArgs e) { MenuControl.Menu98_ExitHost(); buttonDetect_Click(sender, e); }
public static void LaunchUninstall(Form Parent) { bool deleteConfig = false; if (WinVer.IsVistaOrGreater()) { TaskDialog dlg = new TaskDialog(); dlg.Icon = Properties.Resources.Installer.Handle; dlg.WindowTitle = "Uninstall"; dlg.MainInstruction = "Uninstall this software from your system"; dlg.Content = "This program will not be deleted."; dlg.AddButton((int)DialogResult.Yes, "Uninstall now").ShowShield = true; dlg.CommonButtons = TASKDIALOG_COMMON_BUTTON_FLAGS.TDCBF_CANCEL_BUTTON; dlg.UseCommandLinks = true; dlg.CheckBoxText = "Delete configuration file"; if (dlg.ShowDialog(Parent.Handle) == (int)DialogResult.Yes) { deleteConfig = dlg.CheckBoxChecked; } else { return; } } else { switch (MessageBox.Show(Parent, "Uninstall this software from your system.\nYes - Uninstall without deleting config file\nNo - Uninstall and delete the config file", "Uninstall", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)) { case DialogResult.Yes: deleteConfig = false; break; case DialogResult.No: deleteConfig = true; break; case DialogResult.Cancel: return; } } if (MenuControl.isMenu98ModuleLoaded()) { MenuControl.Menu98_ExitHost(); } try { UninstallFromSystem(deleteConfig); } catch (UnauthorizedAccessException) { UninstallWithPrivilage(deleteConfig); } catch (System.Security.SecurityException) { UninstallWithPrivilage(deleteConfig); } MessageBox.Show(Parent, "Uninstalled successfully", "Uninstall", MessageBoxButtons.OK, MessageBoxIcon.Information); Application.Exit(); }
public static void ShowInstaller(Form Parent) { string param = null; if (WinVer.IsVistaOrGreater()) { TaskDialog dlg = new TaskDialog(); dlg.Icon = Properties.Resources.Installer.Handle; dlg.WindowTitle = "Install TMT & Menu98"; dlg.MainInstruction = "Install TMT & Menu98"; dlg.Content = "This tweak requires <a href=\"https://www.microsoft.com/en-us/download/details.aspx?id=49984\">VC2015 runtime</a> installed!"; dlg.ExpandedControlText = "Start up parameter:"; dlg.OnRadioButtonSelected += InstallTD_OnRadioButtonSelected; dlg.OnHyperLinkClicked += InstallTD_OnHyperLinkClicked; for (int id = 0; id <= MenuControl.OSList.Length; id++) { dlg.AddRadioButton(id, MenuControl.GetOSFromIndex(id)); } dlg.SelectedRadioButton = MenuControl.Os2ListIndex(WinVer.SystemVersion); param = MenuControl.GetInjectParamFromIndex(dlg.SelectedRadioButton); if (param == null) { dlg.ExpandedInformation = "No startup"; } else { dlg.ExpandedInformation = param; } dlg.ExpandFooterAreaByDefault = true; dlg.AddButton(100, "Install Now").ShowShield = true; dlg.CommonButtons = TASKDIALOG_COMMON_BUTTON_FLAGS.TDCBF_CLOSE_BUTTON; dlg.UseCommandLinks = true; dlg.EnableHyperLinks = true; int ret = dlg.ShowDialog(Parent.Handle); if (ret != 100) { return; } param = MenuControl.GetInjectParamFromIndex(dlg.SelectedRadioButton); } else { switch (MessageBox.Show(Parent, "Yes - Install and auto startup\nNo - Just install", "Install Menu98", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information)) { case DialogResult.Yes: param = "!Button"; //Hard coding here break; case DialogResult.No: param = null; //Hard coding here break; default: return; } } try { InstallToSystem(WinVer.IsX64System()); if (param == null) { CreateRegConfig(param); } if (!System.IO.File.Exists(GetConfigPath())) { DeployDefaultConfigFile(); } } catch (UnauthorizedAccessException) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.UseShellExecute = true; startInfo.WorkingDirectory = Environment.CurrentDirectory; startInfo.FileName = Application.ExecutablePath; startInfo.Arguments = "INSTALL X" + (WinVer.IsX64System() ? "64" : "86") + " "; if (param == null) { startInfo.Arguments += "\"?\""; } else { startInfo.Arguments += "\"" + param + "\""; } startInfo.Verb = "runas"; try { System.Diagnostics.Process.Start(startInfo).WaitForExit(); } catch (System.ComponentModel.Win32Exception) { MessageBox.Show("This action requires administrative privilage!", "Fail to install", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (param != null) { MenuControl.Menu98_Inject(param); } }