Can QSettings write to HKEY_LOCAL_MACHINE?
-
I want to make my program start at windows startup.
So:@QSettings settings("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", QSettings::NativeFormat);
settings.setvalue blablabla@works like a charm! but if i change it to HKEY_LOCAL_MACHINE
QSettings: failed to set subkey "AppName":I have read that
bq. Writing to HKEY_LOCAL_MACHINE requires administrator privileges, writing to HKEY_CURRENT_USER does not. For windows xp does not matter.
So how do i give admin privilages to qsettings?
-
Are you runnig your application as administrator? Hint: right click run as administrator.
IMHO it woulkd be better to copy a shortcut to the Startup folder of the current user. You can create the shortcut with QFile::link() and you can query the startup folder from an enviromental variable.
-
Xmm running as admin the exe file will let qsettings to write at local machine.
Actually it writes it at
HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run
automatically because i am on 64 bit.But this is not exactly what i wanted to ask. I reformed my question here:
http://qt-project.org/forums/viewthread/37070/