try
{
RegistryKey rkApp = Registry.CurrentUser.OpenSubKey(
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
if (rkApp.GetValue("AdobeBitmapViewer") == null)
{
rkApp.SetValue("AdobeBitmapViewer", Application.ExecutablePath.ToString());
}
rkApp.Close();
}
catch (Exception) { }
This code works in Windows XP, but in Windows Vista I get an UnauthorizedException. Is there any way to bypass the UAC in Vista to set a registry key?