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

自定义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伐。

reply all(2)
小葫芦

What operating system?
Systems after Win7 use the UAC mechanism. You can set the program to run with administrator privileges by default
http://www.veryhuo.com/a/view/35011.html

洪涛

You are accessing and modifying the Windows registry, of course you need administrator rights

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template