c++ - 自定义Url协议报错,需要管理员权限,如何取消权限限制?
伊谢尔伦
伊谢尔伦 2017-04-17 13:56:45
0
2
562

自定义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.

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

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

Antworte allen(2)
小葫芦

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

洪涛

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

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!