保护主题不受更改

Posted on 2019-01-29 00:39  努力成长静待花开  阅读(178)  评论(0编辑  收藏  举报

实现效果:

  

知识运用:

  NoThemesTab键

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer");
            rk.SetValue("NoThemesTab",1,RegistryValueKind.DWord);
            MessageBox.Show("禁用成功");
        }
        private void button2_Click(object sender, EventArgs e)
        {
            RegistryKey rk = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer");
            rk.SetValue("NoThemesTab", 0, RegistryValueKind.DWord);
            MessageBox.Show("开启成功");
        }