Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Run .exe with Administrative privileges
#1
Is there a line of code I can put in a compiled program to force it to run with Administrative privileges? Instead of having to right click on the file and "Run as Administrator" (Vista, 7), it would be nice if the file will open requesting Administrative privileges automatically.

Thanks
#2
In file or shortcut properties select Compatibility, "Run this program as administrator".
Or exe can run self as administrator, using run() function with flag 0x10000 or 0x20000.
In any case, will show consent dialog.
#3
I'm sorry, I still don't understand... Do I put this "run() function with flag 0x10000 or 0x20000" at the beginning of the code? As is or is there something I need to change/tweak? If so, can you give me an example please? Let's just say open Notepad with Adminstrative privileges.

Thank you
#4
Forgot it. Don't use run. Instead edit manifest file. Read more in QM help, "make exe" topic. Just replace word asInvoker to highestAvailable or requireAdministrator. More info - google.
#5
I will look into this. Thank you


Forum Jump:


Users browsing this thread: 1 Guest(s)