var RegTemp : TRegistry; i : Integer;begin RegTemp := TRegistry.Create; Try RegTemp.RootKey := HKEY_CURRENT_USER; if Not RegTemp.KeyExists('Software/Microsoft/Windows/CurrentVersion/Group Policy Objects/本地User/Software/Microsoft/Windows/CurrentVersion/Policies/Explorer') Then RegTemp.CreateKey('Software/Microsoft/Windows/CurrentVersion/Group Policy Objects/本地User/Software/Microsoft/Windows/CurrentVersion/Policies/Explorer'); if RegTemp.OpenKey('Software/Microsoft/Windows/CurrentVersion/Group Policy Objects/本地User/Software/Microsoft/Windows/CurrentVersion/Policies/Explorer', False) Then Begin RegTemp.WriteBool('DisallowRun',True); RegTemp.CloseKey; End; if Not RegTemp.KeyExists('Software/Microsoft/Windows/CurrentVersion/Group Policy Objects/本地User/Software/Microsoft/Windows/CurrentVersion/Policies/Explorer/DisallowRun') Then RegTemp.CreateKey('Software/Microsoft/Windows/CurrentVersion/Group Policy Objects/本地User/Software/Microsoft/Windows/CurrentVersion/Policies/Explorer/DisallowRun'); if RegTemp.OpenKey('Software/Microsoft/Windows/CurrentVersion/Group Policy Objects/本地User/Software/Microsoft/Windows/CurrentVersion/Policies/Explorer/DisallowRun', False) Then Begin RegTemp.WriteString('**delvals.', ' '); i :=0; Repeat i := i+1; Until RegTemp.ReadString(IntToStr(i))=''; RegTemp.WriteString(IntToStr(i), '要禁止运行的程序文件名'); RegTemp.CloseKey; End; if RegTemp.OpenKey('Software/Microsoft/Windows/CurrentVersion/Policies/Explorer', False) Then Begin RegTemp.WriteBool('DisallowRun',True); RegTemp.CloseKey; End; if Not RegTemp.KeyExists('Software/Microsoft/Windows/CurrentVersion/Policies/Explorer/DisallowRun') Then RegTemp.CreateKey('Software/Microsoft/Windows/CurrentVersion/Policies/Explorer/DisallowRun'); if RegTemp.OpenKey('Software/Microsoft/Windows/CurrentVersion/Policies/Explorer/DisallowRun', False) Then Begin i :=0; Repeat i := i+1; Until RegTemp.ReadString(IntToStr(i))=''; RegTemp.WriteString(IntToStr(i), '要禁止运行的程序文件名'); RegTemp.CloseKey; End; Finally RegTemp.Free; End;