How to read from Windows 10 registry?
-
wrote on 6 Jun 2022, 08:54 last edited by
Hi,
OS: Windows 10 64-bit
application, which I wrote: 64 bit for WindowsI have a key in registry:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\companyName\applicationNameHow 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.
-
wrote on 6 Jun 2022, 10:58 last edited by
Hello!
You need to use
QSettings
a bit differently. Please check out my test code below and the docs forQVariant 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!
-
Hi,
OS: Windows 10 64-bit
application, which I wrote: 64 bit for WindowsI have a key in registry:
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\companyName\applicationNameHow 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.
-
wrote on 6 Jun 2022, 10:58 last edited by
Hello!
You need to use
QSettings
a bit differently. Please check out my test code below and the docs forQVariant 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/4