第一个解决者,百分送上!改注册表,在一定时间内只能运行指定程序,知道用组策略管理器,可以实现,不过我想用编程的方法。
改注册表,在一定时间内只能运行指定程序,知道用组策略管理器,可以实现,不过我想用编程的方法。
以下是我的代码,但是不能达到目的,已经研究过N遍了,没有找到问题,请高手,指教。谢谢。第一个解决者,百分送上!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
namespace restrict
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
RegistryKey hkcu = Registry.CurrentUser;
RegistryKey cu = hkcu.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\RestrictRun");
RegistryKey cu1 = hkcu.CreateSubKey(@"SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\Policies\Explorer");
cu1.SetValue("RestrictRun", 1);
cu.SetValue("**delvals.", " ");
cu.SetValue("1", "notepad.exe");
cu.SetValue("2", "bitcomet.exe");
cu.SetValue("3", "gpedit.msc");
cu.SetValue("4", "regedit.exe");
cu.SetValue("5", "tmshell.exe");
cu.SetValue("6", "kav.exe");
cu.SetValue("7", "TTraveler.exe");
cu.SetValue("8", "iexplore.exe");
cu.SetValue("9", "mmc.exe");
cu.SetValue("10", "restrict.exe");
hkcu.Close();
}
int delflag = 1;
public void delres()//删除相关注册表项,清除限制
{
RegistryKey hkcu = Registry.CurrentUser;
RegistryKey hklm = Registry.LocalMachine;
RegistryKey cu = hkcu.OpenSubKey(@"SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\Policies", true);
cu.DeleteSubKeyTree("Explorer");
hkcu.Close();
delflag = 0;
}
private void timer1_Tick(object sender, EventArgs e)
{
if ((DateTime.Now.Hour >= 12)&&(DateTime.Now.Hour <= 14)&&(delflag==1)) //中午12点到下午2点之间,取消限制
{
delres();
}
}
}
}
以下是我的代码,但是不能达到目的,已经研究过N遍了,没有找到问题,请高手,指教。谢谢。第一个解决者,百分送上!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
namespace restrict
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
RegistryKey hkcu = Registry.CurrentUser;
RegistryKey cu = hkcu.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\RestrictRun");
RegistryKey cu1 = hkcu.CreateSubKey(@"SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\Policies\Explorer");
cu1.SetValue("RestrictRun", 1);
cu.SetValue("**delvals.", " ");
cu.SetValue("1", "notepad.exe");
cu.SetValue("2", "bitcomet.exe");
cu.SetValue("3", "gpedit.msc");
cu.SetValue("4", "regedit.exe");
cu.SetValue("5", "tmshell.exe");
cu.SetValue("6", "kav.exe");
cu.SetValue("7", "TTraveler.exe");
cu.SetValue("8", "iexplore.exe");
cu.SetValue("9", "mmc.exe");
cu.SetValue("10", "restrict.exe");
hkcu.Close();
}
int delflag = 1;
public void delres()//删除相关注册表项,清除限制
{
RegistryKey hkcu = Registry.CurrentUser;
RegistryKey hklm = Registry.LocalMachine;
RegistryKey cu = hkcu.OpenSubKey(@"SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\Policies", true);
cu.DeleteSubKeyTree("Explorer");
hkcu.Close();
delflag = 0;
}
private void timer1_Tick(object sender, EventArgs e)
{
if ((DateTime.Now.Hour >= 12)&&(DateTime.Now.Hour <= 14)&&(delflag==1)) //中午12点到下午2点之间,取消限制
{
delres();
}
}
}
}
...全文
相关推荐
xp组策略开启了用户配置→系统→只运行指定的windows应用程序后,解除锁定的方法.txt
### 组策略设置“只运行指定的Windows应用程序”的解锁方法#### 背景与问题描述在确保Windows XP系统安全方面,很多用户选择通过设置组策略中的“只运行许可的Windows应用程序”来防止未授权的应用程序对系统进行潜在的危害
修复本地组策略管理器+修复凭据安全支持提供程序协议 (CredSSP)
解决CredSSP问题的方法如下:1. 按Win+R打开运行对话框,输入“gpedit.msc”打开本地组策略编辑器。2.
雨林木风Win7任务管理器停止运行的解决方法.docx
关闭组策略编辑器,现在任务管理器应该已经可以正常启动了。如果上述方法无效,可能是由于病毒或恶意软件修改了注册表导致的问题。在这种情况下,需要手动修复注册表:1.
任务管理器解决方法,让任务管理器不被禁用
**运行批处理文件**:保存文件后,双击运行即可自动执行上述步骤,尝试恢复任务管理器功能。#### 小结以上几种方法都可以帮助用户解决任务管理器被禁用的问题。
任务管理器被禁用的解决方法
使用组策略编辑器对于运行Windows 10专业版及更高版本的操作系统,还可以通过组策略编辑器来解决此问题:1.


