3

I have written a wizard in C++ which installs some files to the program files folder under windows. As I understand, I need Admin rights to write to program files under Vista/7. So my question is: Is there a way to turn on Admin rights while the application is running respectively only for one wizard page? Or do I have to start another process with Admin rights for this one wizard page?

Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249
mgiza
  • 558
  • 1
  • 7
  • 16

1 Answers1

5

Typically you have a shield logo'd button and then shell out to another process whose manifest requests elevation.

But really it sounds like you're writing an installer so you should use something designed for that like WiX.

See also this similar question and this cited article from one of the answers thereof

Community
  • 1
  • 1
Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249
  • 1
    Kind of but I need some custom controls in it. Besides the application is already written, and I try to make it Windows Vista/7 compatible. – mgiza Nov 25 '09 at 10:08
  • You need another process unless you require admin on startup via a manifest (which is easy but obviously you dont want to require it each time. There's nothing that says you can't invoke yourself of course). Other approaches might be to preassign rights to a directory at install time. Or otherwise write to AppData or ProgramData like you're supposed to insterad of writing directly to Program Files. – Ruben Bartelink Nov 25 '09 at 10:16