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 run开发者_开发问答ning Windows Vista Home premium. Any help would be appreciated!
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?
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.
精彩评论