By default run an exe in run as admin mode using MFC
-
Hi, Can anybody tell me how to run an exe by default in Run as Admin mode irrespective of the user.Please help me with the source code in mfc.
-
Hi, Can anybody tell me how to run an exe by default in Run as Admin mode irrespective of the user.Please help me with the source code in mfc.
This can be controlled using the manifest file for your project. You will the .manifest file which is an XML file in your debug or release folder depending on you current configuration. There is a node called
requestedExecutionLevel
that controls this. By default this will beasInvoker
. The available options here are -requireAdministrator
asInvoker
highestAvailableUsing these levels, you can tell how the application must start.
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
This can be controlled using the manifest file for your project. You will the .manifest file which is an XML file in your debug or release folder depending on you current configuration. There is a node called
requestedExecutionLevel
that controls this. By default this will beasInvoker
. The available options here are -requireAdministrator
asInvoker
highestAvailableUsing these levels, you can tell how the application must start.
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)Thanks for your reply.I tried to edit the .manifest file.But its changing after each build.Can you please tell me the whole process how to do it?
-
Thanks for your reply.I tried to edit the .manifest file.But its changing after each build.Can you please tell me the whole process how to do it?
You can change that by using Projects Settings menu in VS IDE Project Settings > Linker > Manifest File or refer http://vctipsplusplus.wordpress.com/2009/10/21/windows-privileges-issues[^] :)
-
Thanks for your reply.I tried to edit the .manifest file.But its changing after each build.Can you please tell me the whole process how to do it?
Sorry that I didn't tell you how to do it. Take
Project Properties -> Configuration Properties -> Linker -> Manifest File -> UAC Execution Level
. Here you have a drop down box from which you can make your selection.«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
Sorry that I didn't tell you how to do it. Take
Project Properties -> Configuration Properties -> Linker -> Manifest File -> UAC Execution Level
. Here you have a drop down box from which you can make your selection.«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)Hi, Thanks again for your reply . I changed the settings of the project according to you.But it didn't solve my problem.I am explaining my problem to you in details.I want to access the hard disk of my system without being logged on as Administrator.I have created another user,but its unable to retrieve the handle of my hard disk. If I am running my application as Admin and giving the password then its working fine. I hope I have successfully explained you my problem.Please give a solution to my problem.
-
Hi, Thanks again for your reply . I changed the settings of the project according to you.But it didn't solve my problem.I am explaining my problem to you in details.I want to access the hard disk of my system without being logged on as Administrator.I have created another user,but its unable to retrieve the handle of my hard disk. If I am running my application as Admin and giving the password then its working fine. I hope I have successfully explained you my problem.Please give a solution to my problem.
Only a process with administrative privileges will be able retrieve a handle to the hard disk. If the user is not an admin, you will have to give the admin privileges (username and password) for it to work. If any other way was possible, it would be a security breach.
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)