Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run program as administrator... 1

Status
Not open for further replies.

adriantc

Programmer
Feb 15, 2010
3
RO
Hello again!

One of my programs require administrator privileges in order to look some information from the registry. Is there any way to force the UAC dialog in Windows Vista and 7 at startup so the program would get administrative rights? Normally the program starts without asking for permissions and I can't access the registry.

Thanks!
 
You could provide a 'manifest' file, within which you could define that the associated executable requires administrative privileges.

Not sure whether or not this would automatically bring up the UAC dialogue though.
 
The problem is that MSDN offerd examples only for Visual C++... I can't find any embed manifest option in Borland.
 
You can just create a manifest file using NotePad - it's only a text file containing XML.

The name of the manifest file has to be based on the name of your executable file (I can't remember the required naming standard, sorry) and it should be placed in the same folder as the executable file.

The important content (for your purposes) is to include the required 'level' value in the 'requestedExecutionLevel' element.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top