PDA

View Full Version : Can't read Win7 registry value via QSettings



MasterBLB
24th October 2014, 07:21
Hello mates

The code below works fine on Win XP,but it shows 0 on Win7 and Win8


QSettings rnidRegistryEntry("HKEY_LOCAL_MACHINE\\SOFTWARE\\Telenor Connect\\rnid", QSettings::NativeFormat);
int rnid = rnidRegistryEntry.value("Rnid").toInt();//say there is 130 here
QMessageBox::about(this, 0, QString::number(rnid));//XP-shows 130, Win7 - 0

From what I've found out it is due to these more modern systems are more restrictive when it comes to access the registry.So my question is how to get a value from registry on the newer Windows using QSettings?

Ah,I forgot - Qt 5.3.2,Visual Studio 2013,Qt Add-In 1.2.3