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) { }
このコードは Windows XP では機能しますが、Windows Vista では UnauthorizedException が発生します。Vista で UAC をバイパスしてレジストリ キーを設定する方法はありますか?