Imports Microsoft.Win32 Public Class Form1 Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim regKey As RegistryKey 'opens the path USBSTOR from regedit If RadioButton1.Checked Then If MsgBox("All USB Ports Will Be Disabled Except The Presently Connected Ports (Ex.,USB Mouse,Printer etc !) ", MsgBoxStyle.OkCancel, "ARE YOU SURE ?!") = MsgBoxResult.Ok Then regKey = Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Services\USBSTOR", True) regKey.SetValue("Start", 4) ' 4(To disable the ports) End If Else regKey = Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Services\USBSTOR", True) regKey.SetValue("Start", 3) ' 3(To enable the ports) MsgBox("Ports Are Enabled !", MsgBoxStyle.OkOnly) End If End Sub End Class
"regKey = Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Services\USBSTOR", True)"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)