Thanks everyone 4 your contribution 'cos they set me thinking. I have found a way around it and that is setting the 'DisableTaskmgr' value to true in the Registry.
Here is how I was able to accomplish that:
To disable Taskmanager:
Private Sub DisableTaskManager()
Dim regkey As RegistryKey
Dim keyValueInt As String = "1"
Dim subKey As String = "Software\Microsoft\Windows\CurrentVersion\Policies\System"
Try
regkey = Registry.CurrentUser.CreateSubKey(subKey)
regkey.SetValue("DisableTaskMgr", keyValueInt)
regkey.Close()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Registry Error!")
End Try
End Sub
To Enable TaskManager
Private Sub EnableTaskManager()
Dim regkey As RegistryKey
Dim keyValueInt As String = "0"
Dim subKey As String = "Software\Microsoft\Windows\CurrentVersion\Policies\System"
Try
regkey = Registry.CurrentUser.CreateSubKey(subKey)
regkey.SetValue("DisableTaskMgr", keyValueInt)
regkey.Close()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Registry Error!")
End Try
End Sub
Thanks and I hope everyone will find this code snippet useful.