[RESOLVED] [2005] changing registry in vista
i've got a program i wrote in win xp that changes a registry value
vb.net Code:
Public regShell As RegistryKey
Public regKey As RegistryKey = Registry.LocalMachine
'' set startup options
If RunToolStripMenuItem.Checked = False Then
RunToolStripMenuItem.Checked = True
regShell = regKey.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
regShell.SetValue("screen capture", Application.ExecutablePath)
Else
RunToolStripMenuItem.Checked = False
regShell = regKey.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
regShell.SetValue("screen capture", "<NonRun>")
End If
this worked well in win xp, but now i've upgraded to vista, it causes an error:
'attempted to perform an unauthorised operation'
how can i rewrite this so it doesn't cause this error?
thanks
Re: [2005] changing registry in vista
The user running the application must have administrator privileges in order to make changes in the registry, thats why making changes in the registry is not a recommended practise.
Re: [2005] changing registry in vista
i googled it while i was waiting.
you need administrator privileges to change Registry.LocalMachine but not for
Registry.currentuser