Page 1 of 1

TReg32 - Vista elevation

Posted: Wed May 28, 2008 11:26 am
by Davide
Hello guys,

I need to change some registry values which requires Admin rights on Vista.

Do you know some API I can call to request such elevation when I need it instead of asking the user to run my program "As Admin" ?

Thank you,
Davide

Posted: Thu May 29, 2008 6:42 pm
by Antonio Linares

Posted: Thu May 29, 2008 10:18 pm
by Davide
I've solved it creating a .reg file and shellexecuting it.

Thank you anyway.
Davide

Posted: Fri May 30, 2008 10:09 am
by Antonio Linares
Davide,

Would you mind to show the reg file contents ? Or a sample ? Thanks! :-)

Posted: Sat May 31, 2008 12:10 am
by Davide
It's as simple as creating a text file like:

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName]
"ComputerName"="WKS005"
I suggest you using a different reg key for testing (really changing the computer name might not be desirable), then:

Code: Select all

ShellExecute(0,"open","regedit","/s myfile.reg","",1)
You could even shellexecute directly the reg file, but then regedit would popup a lot of confirmations.

Regards,
Davide

Posted: Sat May 31, 2008 10:05 pm
by Antonio Linares
Davide,

Thanks! :-)