TReg32 - Vista elevation

Post Reply
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

TReg32 - Vista elevation

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

regards, saludos

Antonio Linares
www.fivetechsoft.com
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Post by Davide »

I've solved it creating a .reg file and shellexecuting it.

Thank you anyway.
Davide
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Davide,

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

Antonio Linares
www.fivetechsoft.com
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Davide,

Thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply