Click here to Skip to main content
15,884,237 members
Articles / Desktop Programming / Windows Forms
Alternative
Tip/Trick

Enabling and Disabling TaskManager

Rate me:
Please Sign up or sign in to vote.
4.17/5 (3 votes)
28 Jun 2011CPOL 15K   1   7
Couldn't the class RegEdit be replaced by one simple method?private void SetKey(bool enableTaskManager) { using ( var mKey = Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System")) {...
Couldn't the class RegEdit be replaced by one simple method?
C#
private  void SetKey(bool enableTaskManager)
      {
          using (
              var mKey =
                  Registry.CurrentUser.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System"))
          {
              if (mKey != null)
              {
                  mKey.SetValue("DisableTaskMgr", enableTaskManager ? 0 : 1);
              }
          }
      }

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Student
Wales Wales
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Generalupdated my vote to 4 works just great but stil perfer my met... Pin
charles henington28-Jun-11 11:20
charles henington28-Jun-11 11:20 
GeneralSorry Charles, I thought the subkey already existed. I've te... Pin
George Swan28-Jun-11 6:59
mveGeorge Swan28-Jun-11 6:59 
GeneralReason for my vote of 1 Yes it very well could be I just per... Pin
charles henington28-Jun-11 5:41
charles henington28-Jun-11 5:41 
GeneralReason for my vote of 1 Yes it very well could be I just per... Pin
charles henington28-Jun-11 5:40
charles henington28-Jun-11 5:40 
GeneralReason for my vote of 3 Yes it very well could be I just per... Pin
charles henington28-Jun-11 5:13
charles henington28-Jun-11 5:13 
GeneralReason for my vote of 3 Yes it very well could be I just per... Pin
charles henington28-Jun-11 5:12
charles henington28-Jun-11 5:12 
GeneralReason for my vote of 3 Yes it very well could be I just per... Pin
charles henington28-Jun-11 5:10
charles henington28-Jun-11 5:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.