Support Forums

Full Version: [TUT]Enable and Disable TaskManger in vb.net [TUT]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Enable.
Code:
Dim systemRegistry As RegistryKey = Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\System")
        systemRegistry.SetValue("DisableTaskMgr", 0)
        systemRegistry.Close()
        SendStatus("Enabled TaskManger")

Disable.
Code:
Dim systemRegistry As RegistryKey = Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\System")
        systemRegistry.SetValue("DisableTaskMgr", 1)
        systemRegistry.Close()
        SendStatus("Disabled TaskManger")


Have fun.
Import

Code:
Imports Microsoft.Win32

Function

Code:
Function ToggleTaskManager(ByVal State As Integer)
        Try
            Dim systemRegistry As RegistryKey = Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\System")
            If State = 0 Then
                systemRegistry.SetValue("DisableTaskMgr", 1)
                systemRegistry.Close()
            ElseIf State = 1 Then
                systemRegistry.SetValue("DisableTaskMgr", 0)
                systemRegistry.Close()
            End If
            Return True
        Catch ex As Exception
            Return False
        End Try
    End Function

Enable Task Manager

Code:
ToggleTaskManager(1)

Disable Task Manager

Code:
ToggleTaskManager(0)
Thanks, although this is very simple it helped me! Smile
Import

Code:
Imports Microsoft.Win32

Function

Code:
Function ToggleTaskManager(ByVal State As Integer)
        If Not State = 0 Or State = 1 Then
            Try
                Dim systemRegistry As RegistryKey = Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Policies\System")
                systemRegistry.SetValue("DisableTaskMgr", State)
                systemRegistry.Close()
                Return True
            Catch ex As Exception
                Return False
            End Try
        Else
            Return False
        End If
    End Function

Usage

Code:
ToggleTaskManager(1/0)

Less code. Same function. Just saying..
You could also try using Winlock to disable some of Windows settings...

Link:
Code:
http://www.supportforums.net/showthread.php?tid=18700