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をバイパスしてレジストリキーを設定する方法はありますか?Windows VistaでC#を使用してレジストリ値を設定するにはどうすればよいですか?
Registry.CurrentUserに高度が必要です。 – Michael
つまり、Registry.CurrentUserには必要ありません。 – Michael
ok例外をチェックし、欠落しているものを確認します。 –