TReg32 - Vista elevation

TReg32 - Vista elevation

Postby Davide » Wed May 28, 2008 11:26 am

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
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby Antonio Linares » Thu May 29, 2008 6:42 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Davide » Thu May 29, 2008 10:18 pm

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

Thank you anyway.
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby Antonio Linares » Fri May 30, 2008 10:09 am

Davide,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Davide » Sat May 31, 2008 12:10 am

It's as simple as creating a text file like:
Code: Select all  Expand view  RUN
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  Expand view  RUN
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
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Postby Antonio Linares » Sat May 31, 2008 10:05 pm

Davide,

Thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 63 guests