求高手给一个VB.NET的程序开机启动和关闭开机启动的示例代码
1个回答
展开全部
Private Sub 开机自动启动_Click(sender As Object, e As EventArgs) Handles 开机自动启动.Click
Dim a As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Run")
a.SetValue("查看.exe", Application.StartupPath & "\查看.exe")
End Sub
Private Sub 关闭开机自启_Click(sender As Object, e As EventArgs) Handles 关闭开机自启.Click
Dim a As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Run")
a.DeleteValue("查看.exe")
End Sub
Dim a As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Run")
a.SetValue("查看.exe", Application.StartupPath & "\查看.exe")
End Sub
Private Sub 关闭开机自启_Click(sender As Object, e As EventArgs) Handles 关闭开机自启.Click
Dim a As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Run")
a.DeleteValue("查看.exe")
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询