In this program we will show you how to work with registry.
this program is going to hide the turnoff option from the start menu
Just Copy and paste this simple code into your vb.net application and log off your computer and next log on having the same user account then will not be able to shutdown your computer.
In code window above the class Form1 write following line to import
Imports Mycrosoft.Win32
Then take a button and write down the following code into Button1_Click Subroutine
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim regvar As RegistryKey
Dim keyvalue As String
keyvalue = "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer"
regvar = Registry.CurrentUser.OpenSubKey(keyvalue, True)
regvar.SetValue("NoClose", 1)
Dim x As Integer = regvar.GetValue("NoClose")
End Sub
End Class
Solution: - If you want to get back your turnoff option just change the following line and run the vb.net program again.
regvar.SetValue("NoClose", 1) to
0 comments:
Post a Comment