What I can do is step, if I can't achieve the expected effect after reboot then I have to find a way.
The following is my request for help in the Forum of the original:
Change the registry, in a certain period of time can only run the specified program, know that with Group Policy manager, you can achieve, but I want to use the method of programming.
The following is my code, but can not achieve the purpose, has been studied n times, did not find a problem, please master, advice. Thank you. The first solution, the hundred distributed.
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 ();
Flower Pure Spring, http://ike.126.com
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 ("Ten", "Restrict.exe");
Hkcu. Close ();
}
int delflag = 1;
public void Delres ()//delete related registry keys, clear restrictions
{
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 >=) && (DateTime.Now.Hour <=) && (delflag==1))//12 O'Clock to 2 o'clock in the afternoon from noon, remove the restriction
{
Delres ();
}
}
}
}