Can QSettings write to HKEY_LOCAL_MACHINE?
I want to make my program start at windows startup.
@QSettings settings("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", QSettings::NativeFormat);
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
automatically because i am on 64 bit.
But this is not exactly what i wanted to ask. I reformed my question here: