type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure EnableCTRLALTDEL(YesNo : boolean);
const
sRegPolicies = '\Software\Microsoft\Windows\CurrentVersion\Policies';
begin
with TRegistry.Create do
try
RootKey:=HKEY_CURRENT_USER;
if OpenKey(sRegPolicies+'\System\',True) then
begin
case YesNo of
False:
begin
WriteInteger('DisableTaskMgr',1); //任务管理
WriteInteger('DisableLockWorkstation',1);//用户锁定计算机
WriteInteger('DisableChangePassword',1);//用户更改口令
end;
True:
begin
WriteInteger('DisableTaskMgr',0);
WriteInteger('DisableLockWorkstation',0);
WriteInteger('DisableChangePassword',0);
end;
end;
end;
CloseKey;
if OpenKey(sRegPolicies+'\Explorer\',True) then
begin
case YesNo of
False:
begin
WriteInteger('NoChangeStartMenu',1); //开始菜单
WriteInteger('NoClose',1); // 关闭系统菜单
WriteInteger('NoLogOff',1);//注销菜单
WriteInteger('NoRun',1);//运行菜单
WriteInteger('NoSetFolders',1);//设置菜单
end;
True:
begin
WriteInteger('NoChangeStartMenu',0);
WriteInteger('NoClose',0);
WriteInteger('NoLogOff',0);
WriteInteger('NoRun',0);
end;
end;
end;
CloseKey;
finally
Free;
end;
end;