屏蔽和開啟”關機“功能
阿新 • • 發佈:2019-01-29
use class com ocl 實現 send val gist 開啟
實現效果:
知識運用:
註冊表項中的NoClose鍵進行設置
實現代碼:
private void button1_Click(object sender, EventArgs e) { RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"); rk.SetValue("NoClose",1); MessageBox.Show("屏蔽關機功能成功"); } private void button2_Click(object sender, EventArgs e) { RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer"); rk.SetValue("NoClose", 0); MessageBox.Show("開啟關機功能成功,重新啟動生效"); }
屏蔽和開啟”關機“功能