コード例 #1
0
ファイル: StartupManager.cs プロジェクト: flutils/flcleaner
        public void MoveItemToDisabledState(StartupEntry entry)
        {
            RegistryKey rKey = null;

            try
            {
                rKey = Registry.CurrentUser.CreateSubKey("Software\\StartUp\\" + entry.csName + (entry.bLocal ? "HKLM" : "HKCU"));//Microsoft\\Shared Tools\\MSConfig\\startupreg\\" + entry.csName + (entry.bLocal ? "HKLM" : "HKCU"));
                rKey.SetValue("item", entry.csName);
                rKey.SetValue("command", entry.csRegPath);
                rKey.SetValue("hkey", entry.bLocal ? "HKLM" : "HKCU");
                entry.bDisabled = true;
            }
            catch (Exception) { /*MessageBox.Show(ex.Message);*/ }

            try
            {
                if (entry.bLocal)
                {
                    rKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
                }
                else
                {
                    rKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
                }
                rKey.DeleteValue(entry.csName, false);
            }
            catch (Exception) { /*MessageBox.Show(ex.Message); */ }
            finally
            {
                entry.bDisabled = true;
            }
        }
コード例 #2
0
ファイル: StartupManager.cs プロジェクト: flutils/flcleaner
 public void KillStartupEntry(StartupEntry entry)
 {
     try
     {
         RegistryKey rKey = null;
         if (entry.bDisabled)
         {
             Registry.CurrentUser.DeleteSubKey("Software\\StartUp\\" + entry.csName);//Microsoft\\Shared Tools\\MSConfig\\startupreg\\" + entry.csName);
         }
         else
         {
             if (entry.bLocal)
             {
                 rKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
             }
             else
             {
                 rKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
             }
             rKey.DeleteValue(entry.csName, false);
         }
     }
     catch (Exception) { /*MessageBox.Show(ex.Message);*/ }
     finally
     {
         StratUpList.Remove(entry);
     }
 }
コード例 #3
0
ファイル: StartUpPanel.cs プロジェクト: flutils/flcleaner
        private void InsertAnItemToList(StartupEntry entry)
        {
            ListViewItem lv_item = new ListViewItem(entry.csName);

            lv_item.SubItems.Add(entry.bDisabled ? "Disabled" : "Enabled");
            lv_item.SubItems.Add(entry.csRegPath);
            lv_item.Tag = entry;
            ListViewStartup.Items.Add(lv_item);
        }