自定义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.
我用管理员权限运行没这个问题
高洛峰2017-04-17 13:58:45
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
PHP中文网2017-04-17 13:58:45
You are accessing and modifying the Windows registry, of course you need administrator rights