在运行时请求管理员权限
如何在运行时请求管理员权限,以便提示用户允许或禁止?
How do I request Administrator privileges during runtime so the user is given the prompt to allow or disallow it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您希望它响应按钮(例如,任务管理器中的“显示所有用户的进程”),您必须使用以下方法重新启动您的应用程序
if you want it in response to a button (eg, like 'show processes for all users' in task manager), you have to resart your app using the following method
此信息写入 exe 文件清单中。您必须使用
requestedExecutionLevel
字段(但不确定 - 尝试将其设置为highestAvailable
并查看它是否满足您的需要)。有关详细信息,请参阅此处的示例(有些较旧的文章但仍然有效): 链接Visual中有工具Studio 允许您嵌入自己的清单,甚至可以编辑它。还有一个用 Perl 编写的工具( http://metacpan.org/pod/Win32 ::Exe::Manifest )。
编辑:有关详细信息,请参阅本文: http ://www.codeproject.com/Articles/66259/Requesting-Admin-Approval-at-Application-Start.aspx
This information is written in the exe file manifest. You must use the
requestedExecutionLevel
field (but not sure about that - try setting it tohighestAvailable
and see if it does what you need). See for example here for more information (somewhat older article but still valid): LinkThere are tools in Visual Studio which allow you to embed your own manifest or even just edit it. Also there is a tool written in Perl ( http://metacpan.org/pod/Win32::Exe::Manifest ).
EDIT: see this article for more info: http://www.codeproject.com/Articles/66259/Requesting-Admin-Approval-at-Application-Start.aspx