默认情况下如何赋予MFC应用程序管理权限 [英] How to give administration rights to an MFC application by default

查看:83
本文介绍了默认情况下如何赋予MFC应用程序管理权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我开发了一个MFC应用程序,我在代码中使用了很少的注册表条件.由于只允许管理员通过任何应用程序或代码来编辑注册表.因此,使用我的应用程序,我无法编辑注册表.通过我的MFC应用程序注册,我需要右键单击exe,然后选择以管理员身份运行,然后运行exe.

还有其他方法可以让我直接输入代码以管理员身份运行exe.请帮我解决这个问题.

谢谢Advance.

Hello,

I have developed an MFC application,i have used few registry conditions in the code.As the administration will be only allowed to edit the registry through any application or code.So using my application i am not able to edit the registry.To edit the registry through my MFC application i need to right click the exe and select as Run as Administrator and then run the exe.

So is there any other way so that i can give directly in the code to run the exe as a administrator.Kindly help me to solve this.

Thank you in Advance.

推荐答案

在您的项目中,链接器的设置是清单文件的选项卡.有一个名为"UAC执行级别"的设置.通常将其设置为"asInvoker".将其更改为"requireAdministrator".
In your project settings for the linker is a tab for the manifest file. There is a setting called "UAC Execution Level". Normally it is set to "asInvoker". Change it to "requireAdministrator". This will do the trick for you.


除非您的应用程序的主要目的是做管理工作,否则建议的方法是将需要管理员特权的操作放在另一个应用程序中,然后调用该命令.需要执行该操作时从您的应用程序进行操作...

另外,建议在执行该操作的按钮上放置一个盾牌图标.

UAC的目的之一是阻止应用程序创建者修改系统.这是一种保护措施,可以限制恶意软件程序在不被注意的情况下可以执行的操作.

您的应用程序对文件系统或注册表所做的任何更改都应尽可能地属于该用户.在某些情况下,您还可以使用公共文档或应用程序数据...

仅在安装时,您才应写入所有用户公用的位置.
Except if the main purpose of your application is to do administrative things, the recommanded way is to put operations that require administrator priviledge in another application and call that application from yours when you need to do that operation...

Also, it is recommanded to put a shield icon on the button that will executed that operation.

One of the purpose of the UAC is to discourage application creator to modify the system. It is a protection to limit what malware program can do without being noticed.

As much as possible, any changes that your application make to the file system or the registry should be in a portion that belong to that user. In some cases, you can also used public documents or application data...

Only at installation time, you should write to location that are common to all users.


这篇关于默认情况下如何赋予MFC应用程序管理权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆