Title: Disabling The Task Manager in Win 2000/NT
Question: The SCREENSAVER trick for disabling the ctrl-alt-del keys combination does not work in Win 2000/NT. This is a simple registry entry code that will disable the Task Manager button so the user cannot start the Task Manager.
Answer:
// Put this code in your forms oncreate or on activate event.
procedure Tform1.FormCreate(Sender: TObject);
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Policies\System',
True)
then Reg.WriteInteger('DisableTaskMgr',1);
finally
Reg.CloseKey;
Reg.Free;
end;
end;
// Remember to restore the systems state to mormal after exit. put this code
// in your forms ondestroy event
procedure Tcontrolform.FormDestroy(Sender: TObject);
var
Reg: TRegistry;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Policies\System',
True)
then Reg.WriteInteger('DisableTaskMgr',0);
finally
Reg.CloseKey;
Reg.Free;
end;
end;