private void Button10_Click(object sender, EventArgs e) { Counter = 60; try { if (voldis.Checked) { RegistryKey systemRegistry = Registry.CurrentUser.CreateSubKey("\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer"); systemRegistry.SetValue("NoDrives", 0x3ffffff); } else if (volena.Checked) { RegistryKey systemRegistry = Registry.CurrentUser.CreateSubKey("\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer"); systemRegistry.SetValue("NoDrives", 0); } } catch (Exception) { MessageBox.Show("Run this application as Admin to Enable or Disable", "@Need Administrator@"); } DialogResult dialogResult = MessageBox.Show("PC have to reboot for effective", "Attention", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { Process.Start("shutdown", "-R -t 00"); //>>>how to write a code to take immediate effect without restart pc } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)