Visual Studio 2005 C++应用程序想要以管理员身份运行
我在 Visual Studio 2005 中编写了一个简单的 C++ 应用程序,但是当我编译它时,可执行文件想要以管理员身份运行。我尝试删除清单,但它仍然想以管理员身份运行。我运行的是 Windows Vista Home Premium。任何帮助将不胜感激!
I wrote a simple c++ application in Visual Studio 2005 but when I compile it, the executable wants to run as admin. I tried deleting the manifest but it still wants to run as admin. I am running Windows Vista Home premium. Any help would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果可执行文件的名称“看起来像”安装程序的名称,Windows 将要求您提供管理员密码。将可执行文件命名为
setup.exe
,每次运行时都会提示您输入密码。您的可执行文件的名称是什么?Windows will ask you for the administrator password if the name of your executable "looks like" a name of a setup program. Name you executable
setup.exe
and you will be prompted for password every time you run it. What is the name of your executable?为了防止这些启发法为您猜测,请在您的应用程序中放置一个清单。从 Visual Studio 2005 中,它比从 Visual Studio 2008 中更难。我在 http://www 上有说明.gregcons.com/KateBlog/AddingAManifestToAVistaApplication.aspx 详细说明了 http://blogs.msdn.com/cheller/archive/2006/08/24/how -to-embed-a-manifest-in-an-assemble-let-me-count-the-ways.aspx - 这些适用于 VS 2005、C#、VB 和 C++。如果您的应用程序具有 asInvoker 清单,即使它名为 Setup.exe 或 Patch.exe,它也将不再提升。
To prevent these heuristics from guessing for you, put a manifest on your application. From Visual Studio 2005 it is harder than from Visual Studio 2008. I have instructions at http://www.gregcons.com/KateBlog/AddingAManifestToAVistaApplication.aspx that elaborate on those at http://blogs.msdn.com/cheller/archive/2006/08/24/how-to-embed-a-manifest-in-an-assembly-let-me-count-the-ways.aspx - these are for VS 2005, for C#, VB, and C++. If your app has an asInvoker manifest it will no longer elevate even if it's named Setup.exe or Patch.exe.