Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can QSettings write to HKEY_LOCAL_MACHINE?

Can QSettings write to HKEY_LOCAL_MACHINE?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      martonmiklos
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Leon
        wrote on last edited by
        #3

        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/

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved