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. How to read from Windows 10 registry?

How to read from Windows 10 registry?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 312 Views
  • 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.
  • T Offline
    T Offline
    Tomi
    wrote on last edited by
    #1

    Hi,

    OS: Windows 10 64-bit
    application, which I wrote: 64 bit for Windows

    I have a key in registry:
    HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\companyName\applicationName

    How can I read from it?

    When I try:

        QSettings settings(QSettings::Scope::SystemScope, "companyName", "applicationName");
    
        qDebug()<<settings.fileName();
    

    I get:

    "\\HKEY_LOCAL_MACHINE\\Software\\companyName\\applicationName"
    

    I don't see WOW6432Node

    On docs I see only:

    Note: On Windows, for 32-bit programs running in WOW64 mode, settings are stored in the following registry path: HKEY_LOCAL_MACHINE\Software\WOW6432node. 
    
    JonBJ 1 Reply Last reply
    1
    • T Tomi

      @JonB

      Because I have Inno Setup, which add key to this location

      Cobra91151C Offline
      Cobra91151C Offline
      Cobra91151
      wrote on last edited by
      #4

      @Tomi

      Hello!

      You need to use QSettings a bit differently. Please check out my test code below and the docs for QVariant QSettings::value method (https://doc.qt.io/qt-5/qsettings.html#value)

      Code:

      QSettings *testSettings = new QSettings("HKEY_LOCAL_MACHINE\\SOFTWARE\WOW6432Node\\companyName\\applicationName", QSettings::NativeFormat, this);
      QVariant testVariant = testSettings->value(const QString &key, const QVariant &defaultValue = QVariant());
      testSettings->deleteLater();
      

      If you still have issue, feel free to reply. Happy coding!

      1 Reply Last reply
      2
      • T Tomi

        Hi,

        OS: Windows 10 64-bit
        application, which I wrote: 64 bit for Windows

        I have a key in registry:
        HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\companyName\applicationName

        How can I read from it?

        When I try:

            QSettings settings(QSettings::Scope::SystemScope, "companyName", "applicationName");
        
            qDebug()<<settings.fileName();
        

        I get:

        "\\HKEY_LOCAL_MACHINE\\Software\\companyName\\applicationName"
        

        I don't see WOW6432Node

        On docs I see only:

        Note: On Windows, for 32-bit programs running in WOW64 mode, settings are stored in the following registry path: HKEY_LOCAL_MACHINE\Software\WOW6432node. 
        
        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #2

        @Tomi
        The first question is why do you want to access WOW6432Node from a 64-bit program?

        1 Reply Last reply
        1
        • T Offline
          T Offline
          Tomi
          wrote on last edited by
          #3

          @JonB

          Because I have Inno Setup, which add key to this location

          Cobra91151C 1 Reply Last reply
          0
          • T Tomi

            @JonB

            Because I have Inno Setup, which add key to this location

            Cobra91151C Offline
            Cobra91151C Offline
            Cobra91151
            wrote on last edited by
            #4

            @Tomi

            Hello!

            You need to use QSettings a bit differently. Please check out my test code below and the docs for QVariant QSettings::value method (https://doc.qt.io/qt-5/qsettings.html#value)

            Code:

            QSettings *testSettings = new QSettings("HKEY_LOCAL_MACHINE\\SOFTWARE\WOW6432Node\\companyName\\applicationName", QSettings::NativeFormat, this);
            QVariant testVariant = testSettings->value(const QString &key, const QVariant &defaultValue = QVariant());
            testSettings->deleteLater();
            

            If you still have issue, feel free to reply. Happy coding!

            1 Reply Last reply
            2

            • Login

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