Heim  >  Fragen und Antworten  >  Hauptteil

c++ - 自定义Url协议报错,需要管理员权限,如何取消权限限制?

自定义url协议只能用管理员权限?不用管理员权限是否可行?
代码:

            var surekamKey =    Microsoft.Win32.Registry.ClassesRoot.CreateSubKey("hello");
            //以下这些参数都是固定的,不需要更改,直接复制过去 
            var shellKey = surekamKey.CreateSubKey("shell");
            var openKey = shellKey.CreateSubKey("open");
            var commandKey = openKey.CreateSubKey("command");
            surekamKey.SetValue("URL Protocol", "");

错误信息:

System.UnauthorizedAccessException: Access to the registry key 'HKEY_CLASSES_ROOT\hello' is denied.

我用管理员权限运行没这个问题

伊谢尔伦伊谢尔伦2714 Tage vor563

Antworte allen(2)Ich werde antworten

  • 高洛峰

    高洛峰2017-04-17 13:58:45

    什么操作系统?
    Win7之后的系统使用了UAC机制,你可以设置程序默认使用管理员权限运行
    http://www.veryhuo.com/a/view/35011.html

    Antwort
    0
  • PHP中文网

    PHP中文网2017-04-17 13:58:45

    你在访问和修改windows注册表,当然要管理员权限啊

    Antwort
    0
  • StornierenAntwort